diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 13:24:57 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 13:24:57 +0200 |
| commit | 4d63b1d50a593ea2a2475d79bf17d67240eff969 (patch) | |
| tree | 00198cbf11a2cf388dbe701341a66dd4cff5aae9 | |
| parent | 0c0ea6b422907df12deb48a1ea3d332d072b9f69 (diff) | |
| download | quickshell-4d63b1d50a593ea2a2475d79bf17d67240eff969.tar.gz quickshell-4d63b1d50a593ea2a2475d79bf17d67240eff969.zip | |
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.
| -rw-r--r-- | appearance/Hyprsunset.qml | 8 |
1 files changed, 7 insertions, 1 deletions
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() { |
