feat: manage wlsunset via systemd user service
All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 4s
All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 4s
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:
parent
9bc753e092
commit
0433f08f08
@ -20,9 +20,10 @@ Laptops mit `charge_control_end_threshold`-Support (ThinkPad, Framework, etc.) e
|
|||||||
|
|
||||||
## Nightlight (Blaufilter)
|
## Nightlight (Blaufilter)
|
||||||
|
|
||||||
Waybar-Toggle für wlsunset (Wayland-nativer Blaufilter):
|
Waybar-Toggle für wlsunset (Wayland-nativer Blaufilter), persistenter Zustand via systemd:
|
||||||
- `wlsunset` startet per Niri-Autostart mit fester Nacht-Temperatur (5000K)
|
- `wlsunset.service` (systemd User-Service) mit `After=kanshi.service` — startet erst wenn alle Outputs konfiguriert sind
|
||||||
- Klick auf das Nightlight-Modul in `group/brightness` toggled wlsunset an/aus (kill/restart)
|
- Klick auf das Nightlight-Modul in `group/brightness` toggled wlsunset an/aus (`enable --now` / `disable --now`)
|
||||||
|
- Zustand überlebt Reboots (enabled/disabled bleibt bestehen)
|
||||||
- Aktiver Zustand zeigt in Catppuccin Yellow, inaktiv in Standard-Textfarbe
|
- Aktiver Zustand zeigt in Catppuccin Yellow, inaktiv in Standard-Textfarbe
|
||||||
- Signal SIGRTMIN+11 für sofortiges Waybar-Refresh
|
- Signal SIGRTMIN+11 für sofortiges Waybar-Refresh
|
||||||
- Scripts: `moonarch-nightlight` (Toggle), `moonarch-waybar-nightlight` (Status-JSON)
|
- Scripts: `moonarch-nightlight` (Toggle), `moonarch-waybar-nightlight` (Status-JSON)
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ABOUTME: Toggles wlsunset night light on/off.
|
# ABOUTME: Toggles wlsunset night light on/off via systemd user service.
|
||||||
# ABOUTME: Kills or restarts wlsunset process, signals waybar for refresh.
|
# ABOUTME: Persists state across reboots (enable/disable), signals waybar for refresh.
|
||||||
|
|
||||||
if pgrep -x wlsunset > /dev/null; then
|
if systemctl --user is-active --quiet wlsunset; then
|
||||||
pkill -x wlsunset
|
systemctl --user disable --now wlsunset
|
||||||
else
|
else
|
||||||
wlsunset -T 6500 -t 5000 -S 00:00 -s 00:01 &
|
systemctl --user enable --now wlsunset
|
||||||
disown
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pkill -RTMIN+11 waybar
|
pkill -RTMIN+11 waybar
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ABOUTME: Outputs JSON status for waybar nightlight module.
|
# 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"}'
|
jq -nc '{text: "", alt: "on", tooltip: "Nightlight: An (5000K)", class: "on"}'
|
||||||
else
|
else
|
||||||
jq -nc '{text: "", alt: "off", tooltip: "Nightlight: Aus", class: "off"}'
|
jq -nc '{text: "", alt: "off", tooltip: "Nightlight: Aus", class: "off"}'
|
||||||
|
|||||||
19
defaults/etc/systemd/user/wlsunset.service
Normal file
19
defaults/etc/systemd/user/wlsunset.service
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# ABOUTME: systemd user service for wlsunset night light (blue light filter).
|
||||||
|
# ABOUTME: Starts after kanshi to ensure all outputs are configured.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Wlsunset night light (blue light filter)
|
||||||
|
Documentation=man:wlsunset(1)
|
||||||
|
PartOf=graphical-session.target
|
||||||
|
After=graphical-session.target kanshi.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
# Give kanshi time to configure all outputs before wlsunset captures them
|
||||||
|
ExecStartPre=/bin/sleep 2
|
||||||
|
ExecStart=/usr/bin/wlsunset -T 6500 -t 5000 -S 00:00 -s 00:01
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=3
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=graphical-session.target
|
||||||
@ -86,7 +86,7 @@ spawn-at-startup "nm-applet" "--indicator"
|
|||||||
spawn-sh-at-startup "waypaper --restore"
|
spawn-sh-at-startup "waypaper --restore"
|
||||||
// spawn-sh-at-startup "nemo . &> /dev/null &"
|
// spawn-sh-at-startup "nemo . &> /dev/null &"
|
||||||
spawn-sh-at-startup "foot --server"
|
spawn-sh-at-startup "foot --server"
|
||||||
spawn-at-startup "wlsunset" "-T" "6500" "-t" "5000" "-S" "00:00" "-s" "00:01"
|
// wlsunset is managed via systemd user service (wlsunset.service)
|
||||||
// Clipboard history managed by cliphist.service (systemd user service)
|
// Clipboard history managed by cliphist.service (systemd user service)
|
||||||
|
|
||||||
hotkey-overlay {
|
hotkey-overlay {
|
||||||
|
|||||||
@ -178,7 +178,7 @@ section "User Services"
|
|||||||
if [[ $EUID -eq 0 ]]; then
|
if [[ $EUID -eq 0 ]]; then
|
||||||
warn "Running as root — skipping user service checks"
|
warn "Running as root — skipping user service checks"
|
||||||
else
|
else
|
||||||
for svc in kanshi stasis cliphist-text cliphist-image; do
|
for svc in kanshi wlsunset stasis cliphist-text cliphist-image; do
|
||||||
check_user_service "$svc"
|
check_user_service "$svc"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -124,6 +124,7 @@ fi
|
|||||||
log "Enabling systemd user services..."
|
log "Enabling systemd user services..."
|
||||||
USER_SERVICES=(
|
USER_SERVICES=(
|
||||||
"kanshi"
|
"kanshi"
|
||||||
|
"wlsunset"
|
||||||
"stasis"
|
"stasis"
|
||||||
"cliphist-text"
|
"cliphist-text"
|
||||||
"cliphist-image"
|
"cliphist-image"
|
||||||
|
|||||||
@ -345,6 +345,7 @@ echo "source /etc/zsh/zshrc.moonarch" >> "$HOME/.zshrc"
|
|||||||
log "Enabling systemd user services..."
|
log "Enabling systemd user services..."
|
||||||
USER_SERVICES=(
|
USER_SERVICES=(
|
||||||
"kanshi"
|
"kanshi"
|
||||||
|
"wlsunset"
|
||||||
"stasis"
|
"stasis"
|
||||||
"cliphist-text"
|
"cliphist-text"
|
||||||
"cliphist-image"
|
"cliphist-image"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user