feat: manage wlsunset via systemd user service

Move nightlight from niri spawn-at-startup to a systemd user service
with After=kanshi.service to ensure all outputs are configured before
wlsunset starts. Toggle now uses enable/disable --now for persistent
state across reboots.
This commit is contained in:
nevaforget committed 2026-04-14 17:42:24 +02:00
1 parent 365a945ce0
commit 5f475195e4
8 files changed
+34 -13

No files matched your search

+5 -6
View File
@@ -1,12 +1,11 @@
#!/bin/bash
# ABOUTME: Toggles wlsunset night light on/off.
# ABOUTME: Kills or restarts wlsunset process, signals waybar for refresh.
# ABOUTME: Toggles wlsunset night light on/off via systemd user service.
# ABOUTME: Persists state across reboots (enable/disable), signals waybar for refresh.
if pgrep -x wlsunset > /dev/null; then
pkill -x wlsunset
if systemctl --user is-active --quiet wlsunset; then
systemctl --user disable --now wlsunset
else
wlsunset -T 6500 -t 5000 -S 00:00 -s 00:01 &
disown
systemctl --user enable --now wlsunset
fi
pkill -RTMIN+11 waybar
+2 -2
View File
@@ -1,8 +1,8 @@
#!/bin/bash
# ABOUTME: Outputs JSON status for waybar nightlight module.
# ABOUTME: Shows warm icon when wlsunset is active, cool icon when off.
# ABOUTME: Checks wlsunset systemd service, shows warm icon when active.
if pgrep -x wlsunset > /dev/null; then
if systemctl --user is-active --quiet wlsunset; then
jq -nc '{text: "󰌵", alt: "on", tooltip: "Nightlight: An (5000K)", class: "on"}'
else
jq -nc '{text: "󰌶", alt: "off", tooltip: "Nightlight: Aus", class: "off"}'