From 07a1296ca25d103ff9d66c8add4687f2d038b658 Mon Sep 17 00:00:00 2001 From: Thomas Irgang Date: Sun, 16 Aug 2026 10:21:39 +0200 Subject: fix: Keep Waybar alive when switching themes from a bar module (#96) Switching Dark/Light from the Waybar module left the bar gone until the next login. DarkLight.sh is wired to a Waybar module on-click, so it runs inside waybar.service's cgroup. Its cleanup loop kills waybar, systemd tears down the whole unit, and every process in that cgroup goes with it - DarkLight.sh included, before it ever reaches Refresh.sh. Nothing is left to start the replacement bar. Refresh.sh had the same problem on its own: it killed waybar and relaunched it from a shell that had just been torn down. Drop waybar from the DarkLight.sh cleanup loop and let Refresh.sh own the restart, run as a transient systemd-run --user unit so it sits outside the caller's cgroup and survives the teardown. Fall back to setsid where systemd-run is unavailable. Detect systemd management via the unit's LoadState instead of is-enabled. WaybarStartup.sh starts the unit on demand and leaves it disabled, so is-enabled reports "disabled" for setups that are in fact systemd-managed. Co-authored-by: Claude Opus 5 --- config/hypr/scripts/DarkLight.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'config/hypr/scripts/DarkLight.sh') diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 913099fc..5bad2af8 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -354,7 +354,11 @@ ${SCRIPTSDIR}/WallustSwww.sh if [ "$no_restart" -eq 0 ]; then sleep 2 # kill process - for pid1 in waybar rofi swaync ags swaybg; do + # NOTE: waybar is deliberately excluded here. This script is usually launched from a + # waybar module on-click, so it lives in waybar.service's cgroup. Killing waybar makes + # systemd tear down the whole unit, taking this script with it before Refresh.sh runs. + # Refresh.sh restarts waybar detached from that cgroup instead. + for pid1 in rofi swaync ags swaybg; do killall "$pid1" done sleep 1 -- cgit v1.2.3