From 4d63b1d50a593ea2a2475d79bf17d67240eff969 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 16 Sep 2026 13:24:57 +0200 Subject: fix(appearance): wait for hyprsunset exit before restart pkill only sends SIGTERM, and hyprsunset binds Hyprland's CTM manager exclusively, so the replacement started immediately after pkill raced the old process and exited with 'A CTM manager is already running'. Saving from the Sunset tab therefore killed the night-light daemon instead of restarting it. Bound the wait to 5s (50 x 0.1s) so a wedged process cannot hang the restart. --- appearance/Hyprsunset.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/appearance/Hyprsunset.qml b/appearance/Hyprsunset.qml index f488e96..fc0d44a 100644 --- a/appearance/Hyprsunset.qml +++ b/appearance/Hyprsunset.qml @@ -218,9 +218,15 @@ profile { } function saveSettings() { appFile.setText(root.appConfText()); } + // hyprsunset holds Hyprland's CTM manager exclusively, and pkill only + // sends SIGTERM, so the replacement must wait for the old process to + // actually exit or it dies with "A CTM manager is already running". function restart() { Quickshell.execDetached(["sh", "-c", - `pkill -x hyprsunset; setsid -f ${root.daemonCommand}`]); + `pkill -x hyprsunset; ` + + `for i in $(seq 50); do ` + + `pgrep -x hyprsunset >/dev/null 2>&1 || break; sleep 0.1; done; ` + + `setsid -f ${root.daemonCommand}`]); } function save() { -- cgit v1.2.3