From c5e0753e65eacf682770a6951fbf7fd5a2ab195d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 4 Dec 2026 22:00:42 +0100 Subject: fix(services): Restart of an -f daemon now starts it again 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 --- desktop/modules/services/ServicesModule.qml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'desktop/modules') 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(); } -- cgit v1.2.3