From 4c609135e9e4182ef530529b8974ed8ed5d79974 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Thu, 9 Apr 2026 12:08:35 +0200 Subject: [PATCH] feat: add wlsunset nightlight toggle with Waybar module Add blue light filter support via wlsunset, toggleable through a Waybar module in the brightness group. Nightlight icon is the primary element, backlight slider expands on click. - Add wlsunset package to official.txt - Add moonarch-nightlight toggle script (kill/restart wlsunset) - Add moonarch-waybar-nightlight status script (JSON output) - Add custom/nightlight module to group/brightness in Waybar config - Add Catppuccin Yellow highlight for active nightlight state - Add wlsunset autostart in Niri config (5000K night temperature) --- CLAUDE.md | 9 +++++++++ defaults/bin/moonarch-nightlight | 12 ++++++++++++ defaults/bin/moonarch-waybar-nightlight | 9 +++++++++ defaults/xdg/niri/config.kdl | 1 + defaults/xdg/waybar/config | 9 +++++++++ defaults/xdg/waybar/style.css | 4 ++++ packages/official.txt | 1 + 7 files changed, 45 insertions(+) create mode 100755 defaults/bin/moonarch-nightlight create mode 100755 defaults/bin/moonarch-waybar-nightlight diff --git a/CLAUDE.md b/CLAUDE.md index 621f972..8785a3c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,6 +18,15 @@ Laptops mit `charge_control_end_threshold`-Support (ThinkPad, Framework, etc.) e - udev-Regel gibt Gruppe `wheel` Schreibzugriff auf den Threshold (kein sudo nötig) - Auf Desktops ohne Battery-Support versteckt sich das Feature komplett +## Nightlight (Blaufilter) + +Waybar-Toggle für wlsunset (Wayland-nativer Blaufilter): +- `wlsunset` startet per Niri-Autostart mit fester Nacht-Temperatur (5000K) +- Klick auf das Nightlight-Modul in `group/brightness` toggled wlsunset an/aus (kill/restart) +- Aktiver Zustand zeigt 󰌵 in Catppuccin Yellow, inaktiv 󰌶 in Standard-Textfarbe +- Signal SIGRTMIN+11 für sofortiges Waybar-Refresh +- Scripts: `moonarch-nightlight` (Toggle), `moonarch-waybar-nightlight` (Status-JSON) + ## Konventionen - Paketlisten sind einfache Textdateien, ein Paket pro Zeile, Kommentare mit `#` diff --git a/defaults/bin/moonarch-nightlight b/defaults/bin/moonarch-nightlight new file mode 100755 index 0000000..3704cac --- /dev/null +++ b/defaults/bin/moonarch-nightlight @@ -0,0 +1,12 @@ +#!/bin/bash +# ABOUTME: Toggles wlsunset night light on/off. +# ABOUTME: Kills or restarts wlsunset process, signals waybar for refresh. + +if pgrep -x wlsunset > /dev/null; then + pkill -x wlsunset +else + wlsunset -T 6500 -t 5000 -S 00:00 -s 00:01 & + disown +fi + +pkill -RTMIN+11 waybar diff --git a/defaults/bin/moonarch-waybar-nightlight b/defaults/bin/moonarch-waybar-nightlight new file mode 100755 index 0000000..5b4d4bd --- /dev/null +++ b/defaults/bin/moonarch-waybar-nightlight @@ -0,0 +1,9 @@ +#!/bin/bash +# ABOUTME: Outputs JSON status for waybar nightlight module. +# ABOUTME: Shows warm icon when wlsunset is active, cool icon when off. + +if pgrep -x wlsunset > /dev/null; then + jq -nc '{text: "󰌵", alt: "on", tooltip: "Nightlight: An (5000K)", class: "on"}' +else + jq -nc '{text: "󰌶", alt: "off", tooltip: "Nightlight: Aus", class: "off"}' +fi diff --git a/defaults/xdg/niri/config.kdl b/defaults/xdg/niri/config.kdl index 978fb92..b7753c0 100644 --- a/defaults/xdg/niri/config.kdl +++ b/defaults/xdg/niri/config.kdl @@ -86,6 +86,7 @@ spawn-at-startup "nm-applet" "--indicator" spawn-sh-at-startup "waypaper --restore" // spawn-sh-at-startup "nemo . &> /dev/null &" spawn-sh-at-startup "foot --server" +spawn-at-startup "wlsunset" "-T" "6500" "-t" "5000" "-S" "00:00" "-s" "00:01" // Clipboard history managed by cliphist.service (systemd user service) hotkey-overlay { diff --git a/defaults/xdg/waybar/config b/defaults/xdg/waybar/config index 5931100..f4ae831 100644 --- a/defaults/xdg/waybar/config +++ b/defaults/xdg/waybar/config @@ -61,6 +61,7 @@ "group/brightness": { "orientation": "inherit", "modules": [ + "custom/nightlight", "backlight", "backlight/slider" ], @@ -304,6 +305,14 @@ "" ] }, + "custom/nightlight": { + "exec": "moonarch-waybar-nightlight", + "return-type": "json", + "interval": "once", + "signal": 11, + "on-click": "moonarch-nightlight", + "format": "{}" + }, "custom/cpugov": { "exec": "moonarch-waybar-cpugov", "return-type": "json", diff --git a/defaults/xdg/waybar/style.css b/defaults/xdg/waybar/style.css index 91059f3..2a32537 100644 --- a/defaults/xdg/waybar/style.css +++ b/defaults/xdg/waybar/style.css @@ -257,6 +257,10 @@ widget widget>* { color: alpha(@theme_selected_bg_color, 0.9); } +#custom-nightlight.on { + color: #f9e2af; +} + menu { border-radius: 4px; } diff --git a/packages/official.txt b/packages/official.txt index 58e017a..62925a5 100644 --- a/packages/official.txt +++ b/packages/official.txt @@ -63,6 +63,7 @@ waybar swaync cliphist wl-clipboard +wlsunset libnotify upower awww