summaryrefslogtreecommitdiffstats
path: root/restart.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-26 12:36:47 +0200
committerDanilo M. <danix@danix.xyz>2026-09-26 12:36:47 +0200
commitf5948fc5a6ec7ca91c6f454ca119a453a0ecb1a8 (patch)
tree2a26efd65952afb21f6694d1f25ea1190bdf407c /restart.sh
parent746e8c05512675b1c059d73f5f54d977d5e8e8e3 (diff)
downloaddesktop-assistant-f5948fc5a6ec7ca91c6f454ca119a453a0ecb1a8.tar.gz
desktop-assistant-f5948fc5a6ec7ca91c6f454ca119a453a0ecb1a8.zip
Add a Slackware updates tool and a restart script
updates.py compares the -current ChangeLog with the installed package database: the newest batch holding an installed package is the last one applied, everything newer is pending. The spoken summary gives counts, security fixes and a kernel bump, never package lists; report=true writes a full markdown recap and opens it in MD_EDITOR, detached. restart.sh stops a running assistant and its quickshell overlay and starts both again in their own session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'restart.sh')
-rwxr-xr-xrestart.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/restart.sh b/restart.sh
new file mode 100755
index 0000000..24dd5ea
--- /dev/null
+++ b/restart.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# desktop-assistant: restart the voice loop, detached from the terminal.
+# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# restart.sh: SIGTERM any running assistant.py (whisper-server and amixer
+# die with it through PDEATHSIG), SIGKILL after 10 s, then start a new one
+# in its own session, logging where the Hyprland autostart does. The
+# quickshell overlay (OVERLAY, default the quickshell repo next to this one)
+# is restarted the same way. Run it from the login session: it needs its
+# audio, bus, Wayland display and XDG_RUNTIME_DIR.
+
+set -eu
+
+dir=$(cd "$(dirname "$0")" && pwd)
+log="${XDG_RUNTIME_DIR:?not in a login session}/desktop-assistant.log"
+overlay=$(realpath -m "${OVERLAY:-$dir/../quickshell/assistant}")
+pat='^\S*python3 (-u )?\S*assistant\.py'
+qpat="^qs -p $overlay\$"
+
+stop() {
+ pkill -u "$USER" -f "$1" || return 0
+ for _ in $(seq 50); do
+ pgrep -u "$USER" -f "$1" >/dev/null || return 0
+ sleep 0.2
+ done
+ pkill -KILL -u "$USER" -f "$1" && sleep 0.5 || true
+}
+
+stop "$pat"
+stop "$qpat"
+
+cd "$dir"
+setsid -f python3 -u "$dir/assistant.py" >>"$log" 2>&1 </dev/null
+setsid -f qs -p "$overlay" >/dev/null 2>&1 </dev/null
+sleep 0.5
+pgrep -u "$USER" -af "$pat" || { echo "assistant not running, see $log" >&2; exit 1; }
+pgrep -u "$USER" -af "$qpat" || { echo "overlay not running: qs -p $overlay" >&2; exit 1; }