Files
Nomarchy/bin/nomarchy-toggle-nightlight
Bernardo Magri 29cc0d2547 feat: implement modular foundation and core system services
- Update flake.nix with 25.11 release and core inputs
- Add dedicated modules for audio (Pipewire), bluetooth, and networking
- Update GEMINI.md with the new Modular Merging Architecture blueprint
- Configure graphical installer ISO and test VM outputs
2026-04-03 21:06:42 +01:00

37 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Toggles the nightlight (hyprsunset) between enabled (4000) and disabled (6500)
# Declarative + Hybrid (instant IPC) for Nomarchy NixOS.
STATE_FILE="$HOME/.config/home-manager/hyprsunset-state.json"
mkdir -p "$(dirname "$STATE_FILE")"
if [ ! -f "$STATE_FILE" ]; then
echo '{"enabled": false, "temperature": 4000}' > "$STATE_FILE"
fi
enabled=$(jq -r '.enabled' "$STATE_FILE")
if [[ $enabled == "true" ]]; then
NEW_ENABLED="false"
TEMP=6500
notify-send -u low " Nightlight DISABLED"
else
NEW_ENABLED="true"
TEMP=4000
notify-send -u low " Nightlight ENABLED"
fi
# Instant feedback via IPC
if pgrep -x hyprsunset >/dev/null; then
hyprctl hyprsunset temperature $TEMP
else
# Should be started by systemd, but just in case
setsid hyprsunset -t $TEMP &
fi
echo "{\"enabled\": $NEW_ENABLED, \"temperature\": 4000}" > "$STATE_FILE"
echo "Nightlight set to $NEW_ENABLED ($TEMP) declaratively."
# No need to run env-update if we don't want the delay,
# as next HM switch will pick it up and apply it.