aboutsummaryrefslogtreecommitdiffstats
path: root/desktop
diff options
context:
space:
mode:
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();
}