feat(nightlight): menu + Waybar on/off toggle
Add a runtime toggle for the scheduled blue-light filter, the remaining optional item on the night-light roadmap entry. nomarchy-nightlight (nightlight.nix, always on PATH) starts/stops the hyprsunset *service* rather than poking its runtime gamma: `systemctl --user is-active` is the single source of truth, the screen restores to true colours when stopped, and it lets you force the filter off for colour-sensitive work (even at night) and back on without touching config. It self-gates — `status` prints nothing when the unit is absent — so the indicator hides itself when night-light isn't enabled. - Menu: `nomarchy-menu nightlight` toggles it; a self-gated row in the System submenu (shown only when the hyprsunset unit exists). - Waybar: a self-gating `custom/nightlight` indicator (moon = on, sun = off), in the generated bar and both summer whole-swap themes for parity. Verified: home generation builds, generated waybar config carries custom/nightlight, the menu has the dispatcher case + System row, both scripts pass bash -n, and status self-gates to empty with no unit. Pending an on-machine check that stopping hyprsunset cleanly restores the gamma. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -178,6 +178,14 @@ let
|
||||
&& notify-send "Do Not Disturb off" "Notifications resumed."
|
||||
exit 0 ;;
|
||||
|
||||
nightlight)
|
||||
# Force the scheduled blue-light filter on/off for the session by
|
||||
# starting/stopping hyprsunset (nomarchy-nightlight, from nightlight.nix).
|
||||
# Self-gated in the menu; guard here too in case it's invoked directly.
|
||||
command -v nomarchy-nightlight >/dev/null 2>&1 \
|
||||
&& exec nomarchy-nightlight toggle
|
||||
notify-send "Night light" "Not available (nomarchy.nightlight off?)."; exit 0 ;;
|
||||
|
||||
snapshot)
|
||||
# btrfs-assistant: snapshot browse / diff / restore / rollback over
|
||||
# snapper, elevating via polkit. Shipped system-side with
|
||||
@@ -219,6 +227,8 @@ let
|
||||
row "Network" network-wireless
|
||||
row "Bluetooth" bluetooth
|
||||
row "Do Not Disturb" notification-disabled
|
||||
systemctl --user cat hyprsunset.service >/dev/null 2>&1 \
|
||||
&& row "Night light" weather-clear-night
|
||||
command -v btrfs-assistant >/dev/null 2>&1 && row "Snapshots" timeshift
|
||||
if [ -e "''${bats[0]}" ] && command -v powerprofilesctl >/dev/null 2>&1; then
|
||||
row "Power profile" preferences-system-power
|
||||
@@ -229,6 +239,7 @@ let
|
||||
*Network*) exec "$0" network ;;
|
||||
*Bluetooth*) exec "$0" bluetooth ;;
|
||||
*"Do Not Disturb"*) exec "$0" dnd ;;
|
||||
*"Night light"*) exec "$0" nightlight ;;
|
||||
*Snapshots*) exec "$0" snapshot ;;
|
||||
*"Power profile"*) exec "$0" power-profile ;;
|
||||
*Back*) exec "$0" ;;
|
||||
@@ -256,7 +267,7 @@ let
|
||||
esac ;;
|
||||
|
||||
*)
|
||||
echo "usage: nomarchy-menu [tools|system|power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask|dnd|snapshot]" >&2
|
||||
echo "usage: nomarchy-menu [tools|system|power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask|dnd|nightlight|snapshot]" >&2
|
||||
exit 64 ;;
|
||||
esac
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user