aboutsummaryrefslogtreecommitdiffstats
path: root/desktop
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-12-04 22:00:42 +0100
committerDanilo M. <danix@danix.xyz>2026-12-04 22:00:42 +0100
commitc5e0753e65eacf682770a6951fbf7fd5a2ab195d (patch)
tree9437d2946d6cfb63e58f7e598ad4eeacafc848b8 /desktop
parenta9a5ebd78ef4d975fe4cce817ea7c6948588b732 (diff)
downloadquickshell-c5e0753e65eacf682770a6951fbf7fd5a2ab195d.tar.gz
quickshell-c5e0753e65eacf682770a6951fbf7fd5a2ab195d.zip
fix(services): Restart of an -f daemon now starts it againHEADmaster
The autostart line went to the sh -c as an argument, and it holds the daemon's name in plain text, so pkill -f matched that sh and killed it before it reached the start: Stop worked, Restart only stopped, for the assistant, cal-notif, tv-mpris, the mail scripts and cliphist. The line now goes in the environment, which pgrep -f does not search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/modules/services/ServicesModule.qml11
1 files changed, 7 insertions, 4 deletions
diff --git a/desktop/modules/services/ServicesModule.qml b/desktop/modules/services/ServicesModule.qml
index 7512793..1277172 100644
--- a/desktop/modules/services/ServicesModule.qml
+++ b/desktop/modules/services/ServicesModule.qml
@@ -54,15 +54,18 @@ Module {
// Stop is pkill, then up to 5s for the process to go: hyprsunset holds
// Hyprland's CTM manager until it exits, and a second one dies. Start runs
// the autostart.lua line through Hyprland, so its [workspace] rule
- // applies as at login.
+ // applies as at login. The start line goes in the environment, not argv:
+ // it holds the daemon's name in plain text, so as an argument pkill -f
+ // matched the sh running it and killed it before the start (Stop and
+ // Restart of every -f daemon only stopped).
function daemon(d, op) {
const start = op === "stop" || !d.start ? "" : 'hl.dsp.exec_cmd("' + A.quote(d.start) + '")';
- Quickshell.execDetached(["sh", "-c",
- 'start=$1; kill=$2; shift 2; '
+ Quickshell.execDetached(["env", "start=" + start, "sh", "-c",
+ 'kill=$1; shift; '
+ 'if [ "$kill" = 1 ]; then pkill "$@"; '
+ 'for i in $(seq 50); do pgrep "$@" >/dev/null || break; sleep 0.1; done; fi; '
+ '[ -z "$start" ] || hyprctl dispatch "$start"',
- "sh", start, op === "start" ? "0" : "1"].concat(d.args));
+ "sh", op === "start" ? "0" : "1"].concat(d.args));
repoll.restart();
}