aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/DarkLight.sh
diff options
context:
space:
mode:
authorThomas Irgang <info@tomirgang.de>2026-08-16 10:21:39 +0200
committerPinapelz <yukais@pinapelz.com>2026-08-29 21:41:34 -0700
commit07a1296ca25d103ff9d66c8add4687f2d038b658 (patch)
treea1ecf51a33866ad20062b5adc6410fcbcef38e12 /config/hypr/scripts/DarkLight.sh
parent9423a676432fe9aa40675e4cdf94a4736e6f5a64 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'config/hypr/scripts/DarkLight.sh')
-rwxr-xr-xconfig/hypr/scripts/DarkLight.sh6
1 files changed, 5 insertions, 1 deletions
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage