diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-18 17:04:57 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-18 17:04:57 +0100 |
| commit | e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc (patch) | |
| tree | fee3f3ced727f01c7bc630418a6e0b47d347df40 /desktop/modules/shells/restart.sh | |
| parent | 44f947c642fe842fae80c7407399265aa47e9909 (diff) | |
| download | quickshell-e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc.tar.gz quickshell-e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc.zip | |
feat(services): one drawer page to start, stop and restart services
Running things is a runtime operation, so it belongs in the drawer, not
the settings window. The drawer's deck-it tile and keystone's Shells page
become one Services tile: every quickshell shell, deck-it, and the
desktop's long-running daemons (desktop-assistant, cal-notif, tv-mpris,
mail-watcher, mail-notify, hypridle, hyprsunset, the polkit agent,
notifyd, playerctld, conky and cliphist's watcher), each with Start,
Stop and Restart.
A daemon's start command is its enabled autostart.lua line, run through
hyprctl dispatch hl.dsp.exec_cmd as Autostart's Try does, so conky keeps
its workspace rule and no command is copied out of autostart.lua.
Services.js holds only the label, the piece of the line that finds it
and the pgrep/pkill arguments. Stop waits up to 5s for the process to
exit, which hyprsunset needs to free Hyprland's CTM manager. -f patterns
bracket a letter so pgrep and pkill never match the sh that runs them.
Checked: test_services.js; the pgrep list reports all twelve daemons
running; a playerctld restart through the same command came back under
a new pid. QML's JS engine has no Array.flatMap, hence the concat.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/shells/restart.sh')
| -rwxr-xr-x | desktop/modules/shells/restart.sh | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/desktop/modules/shells/restart.sh b/desktop/modules/shells/restart.sh deleted file mode 100755 index 2975d41..0000000 --- a/desktop/modules/shells/restart.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# 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. - -# restart.sh <repo> <shell>...: reload.sh on the named shells, then one -# notification saying which came back. A shell came back when qs lists an -# instance on its config path under a pid it did not have before, within 5s: -# the old instance can still be listed for a moment after qs kill, and a -# config that fails to load exits rather than lingering. -# -# ponytail: "came back" is the process, not the config. A shell that loads -# with a broken component still counts; its log says so. - -root=$(cd "$1" && pwd) || exit 1 -shift - -# The pids qs lists for <shell>'s config path, one per line. -pids() { - qs list --all 2>/dev/null | awk -v p="Config path: $root/$1/shell.qml" ' - /Process ID:/ { id = $3 } index($0, p) { print id }' -} - -old="" -for n; do old="$old $(pids "$n")"; done - -"$root/reload.sh" "$@" >/dev/null 2>&1 - -good="" -bad="" -for n; do - back="" - for _ in 1 2 3 4 5 6 7 8 9 10; do - for p in $(pids "$n"); do - case " $old " in *" $p "*) ;; *) back=1 ;; esac - done - [ -n "$back" ] && break - sleep 0.5 - done - if [ -n "$back" ]; then good="$good $n"; else bad="$bad $n"; fi -done - -if [ -n "$bad" ]; then - notify-send --app-name=Keystone --urgency=critical --icon=dialog-error \ - "Shells" "Did not come back:$bad${good:+. Restarted:$good}" -else - notify-send --app-name=Keystone --icon=dialog-information "Shells" "Restarted:$good" -fi |
