Compare commits

...

7 Commits

Author SHA1 Message Date
Jamie Albert
597109e8b8 add: smartgit auto settings 2025-11-13 21:15:49 +00:00
Jamie Albert
812d192552 add: shortcut handler for kitty 2025-11-13 20:54:37 +00:00
Jamie Albert
ee0be951e3 add: help 2025-11-13 20:53:43 +00:00
Jamie Albert
fbb5b34335 fix: add users and change target 2025-11-13 19:55:31 +00:00
Jamie Albert
4331d809ec mod: increase retry delay 2025-11-13 19:54:56 +00:00
Jamie Albert
3e4725c29a fix: attempt at fixing low boot space 2025-11-13 19:54:35 +00:00
Jamie Albert
b8b2bb75ba rm: old file 2025-11-13 19:54:20 +00:00
10 changed files with 153 additions and 47 deletions

View File

@@ -3,8 +3,8 @@
# @file_name: dao.sh
# @description: main script handle for dao
# @date: 2025-11-12
# @version: 0.0.1
# @usage: ./dao.sh {update|transfer|pwgen|mount|firewall} [args]
# @version: 0.1.0
# @usage: ./dao.sh {kitty|mount|pwgen|update} [args]
#
# @author: Jamie Albert
# @author_contact: <mailto:jamie.albert@flatmail.me
@@ -13,36 +13,60 @@
# ---
set -euo pipefail
show_help() {
cat <<'EOF'
Usage: dao.sh <COMMAND> [OPTIONS]
A command dispatcher for various utilities and scripts.
COMMANDS:
kitty [OPTIONS] Manage Kitty terminal instances
--list List current Kitty instances
--new-instance Launch new Kitty instance
--new-tab Launch new Kitty tab
mount [OPTIONS] Mount filesystems
pwgen [OPTIONS] Generate secure passwords
update Update system packages
EXAMPLES:
dao update Run system update
dao mount --unmount Unmount filesystems
dao kitty --list List Kitty instances
dao kitty --new-tab Launch Kitty or new tab
Use 'dao <COMMAND> --help' for command-specific help.
EOF
exit 0
}
[[ "${1:-}" == "-h" || "${1:-}" == "--help" ]] && show_help
declare -g COMMAND=${1:-}
shift || true
# ---
# shellcheck disable=1091
# ---
setup() {
main() {
. /usr/local/share/dao/libs/libs_dao.sh
. /usr/local/share/dao/config/dao.conf
}
declare -g COMMAND=$1
shift
main() {
setup
case "${COMMAND}" in
update)
"${DAO_SCRIPTS_DIR}/on_demand/update.sh" "$@"
;;
transfer)
"${DAO_SCRIPTS_DIR}/on_demand/transfer.sh" "$@"
;;
pwgen)
"${DAO_SCRIPTS_DIR}/on_demand/pwgen.sh" "$@"
kitty)
"${DAO_SCRIPTS_DIR}/patches/kitty_handler.sh" "$@"
;;
mount)
"${DAO_SCRIPTS_DIR}/reboot/mount.sh" "$@"
;;
pwgen)
"${DAO_SCRIPTS_DIR}/on_demand/pwgen.sh" "$@"
;;
update)
"${DAO_SCRIPTS_DIR}/on_demand/update.sh" "$@"
;;
"")
dao::error 1 "No command provided. Use -h for help." >&2
;;
*)
echo "Usage: dao {update|transfer|pwgen|mount|firewall} [args]"
exit 1
dao::error 1 "Unknown command: ${COMMAND}" >&2
;;
esac
}

View File

@@ -6,7 +6,7 @@ _dao_completion() {
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
mapfile -t commands < <(printf "update\ntransfer\npwgen\nmount\n")
mapfile -t commands < <(printf "kitty\nmount\npwgen\nupdate\n")
case "${COMP_CWORD}" in
1)
@@ -17,8 +17,8 @@ _dao_completion() {
pwgen)
mapfile -t COMPREPLY < <(compgen -W "3 4 5 6 7 8 9 10" -- "${cur}")
;;
transfer)
mapfile -t COMPREPLY < <(compgen -W "-d -u -uc -ur" -- "${cur}")
kitty)
mapfile -t COMPREPLY < <(compgen -W "--list --new-instance --new-tab" -- "${cur}")
;;
*) ;;
esac

View File

@@ -11,3 +11,13 @@
gpgsign = true
[tag]
gpgSign = true
[pull]
rebase = false
[gui]
pruneduringfetch = true
[smartgit "submodule"]
fetchalways = false
update = true
initializenew = true
[push]
recurseSubmodules = check

View File

@@ -3,7 +3,7 @@
[main]
max_parallel_downloads=10
gpgcheck=1
installonly_limit=3
installonly_limit=2
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True

View File

@@ -57,7 +57,7 @@ shell_integration enabled
strip_trailing_spaces smart
editor codium
allow_remote_control yes
listen_on unix:~/.config/kitty/.kitty_socket
listen_on unix:/tmp/kitty.socket
strip_trailing_spaces smart
# --- Keybinds

View File

@@ -0,0 +1,86 @@
#!/usr/bin/env bash
# ---
# @file_name: kitty_handler.sh
# @description: A script to launch an new instance, or if opened, then a new tab in the kitty terminal emulator
# @date: 2025-11-13
# @version: 0.0.1
# @usage: ./kitty_handler.sh [-h|--help]
#
# @author: Jamie Albert
# @author_contact: <mailto:jamie.albert@flatmail.me
# @license: GNU Affero General Public License v3.0 (Included in LICENSE)
# Copyright (C) 2025, Jamie Albert
# ---
set -euo pipefail
show_help() {
cat <<'EOF'
Usage: ./kitty_handler.sh [OPTIONS]
A script to launch an new instance, or if opened, then a new tab in the kitty terminal emulator.
OPTIONS:
-h, --help Show this help message and exit
-l, --list Returns current kitty instances
-ni, --new-instance Launches a new kitty instance
-nt, --new-tab Launches a new kitty tab
EXAMPLES:
./kitty_handler.sh -h Show this help
./kitty_handler.sh -l Returns current kitty instances
./kitty_handler.sh -ni Launches a new kitty instance
./kitty_handler.sh -nt Launches a new kitty tab
EOF
exit 0
}
# ---
# shellcheck disable=1091
# ---
main() {
[[ $# -eq 0 ]] && set -- "-nt"
[[ "$1" == "-h" || "$1" == "--help" ]] && show_help
. /usr/local/share/dao/libs/libs_dao.sh
case "$1" in
-nt | --new-tab)
dao::info "Looking for a kitty instance"
socket=$(find /tmp -name "kitty.socket-*" -type s 2>/dev/null | head -1 || true)
if pgrep -x kitty >/dev/null; then
new_window=$(kitty @ --to "unix:${socket}" launch --type=tab)
kitty @ --to "unix:${socket}" focus-window --match "id:${new_window}"
else
/usr/bin/kitty
fi
;;
-ni | --new-instance)
/usr/bin/kitty
;;
-l | --list)
if pgrep -x kitty >/dev/null; then
dao::info "Available Kitty sessions:"
/usr/bin/kitty @ ls | python3 -c "
import sys, json
data = json.load(sys.stdin)
for i, os_window in enumerate(data):
print(f'OS Window {i+1}:')
for tab in os_window['tabs']:
print(f' Tab {tab[\"id\"]}: {tab[\"title\"]} (Focused: {tab.get(\"is_focused\", False)})')
for window in tab['windows']:
print(f' Window {window[\"id\"]}: {window[\"title\"]}')
if 'cwd' in window:
print(f' CWD: {window[\"cwd\"]}')
if 'pid' in window:
print(f' PID: {window[\"pid\"]}')
"
else
dao::error "No kitty instances are running."
fi
;;
*)
dao::error 1 "Unknown option: $1" >&2
;;
esac
}
main "$@"

View File

@@ -1,18 +0,0 @@
#!/usr/bin/env bash
# ---
# @file_name: kitty_send.sh
# @version: 1.0.0
# @description: handles commands from kws alias
# @author: Jamie Albert (empty_produce)
# @author_contact: <mailto:empty.produce@flatmail.me>
# @license: GNU Affero General Public License v3.0 (Included in LICENSE)
# Copyright (C) 2025, Jamie Albert
# ---
main() {
stty -echo
exec "$@"
stty echo
}
main "$@"

View File

@@ -6,7 +6,7 @@ set -euo pipefail
readonly LOG_PREFIX="[dao_am.service]"
readonly MAX_RETRIES=30
readonly RETRY_DELAY=5
readonly RETRY_DELAY=10
# Configuration
declare -A RCLONE_MOUNTS=(

View File

@@ -8,6 +8,8 @@ Type=simple
ExecStart=bash /usr/local/bin/dao.sh mount
Restart=on-failure
RestartSec=10
User=jamie
Group=jamie
[Install]
WantedBy=default.target
WantedBy=multi-user.target

View File

@@ -9,6 +9,8 @@ Type=simple
ExecStart=bash /usr/local/bin/dao.sh mount
Restart=on-failure
RestartSec=10
User=jamie
Group=jamie
[Install]
WantedBy=default.target
WantedBy=multi-user.target