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
This commit is contained in:
@@ -1,30 +1,36 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Default temperature values
|
||||
ON_TEMP=4000
|
||||
OFF_TEMP=6000
|
||||
# Toggles the nightlight (hyprsunset) between enabled (4000) and disabled (6500)
|
||||
# Declarative + Hybrid (instant IPC) for Nomarchy NixOS.
|
||||
|
||||
# Ensure hyprsunset is running
|
||||
if ! pgrep -x hyprsunset; then
|
||||
setsid uwsm-app -- hyprsunset &
|
||||
sleep 1 # Give it time to register
|
||||
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
|
||||
|
||||
# Query the current temperature
|
||||
CURRENT_TEMP=$(hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+')
|
||||
enabled=$(jq -r '.enabled' "$STATE_FILE")
|
||||
|
||||
restart_nightlighted_waybar() {
|
||||
if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then
|
||||
nomarchy-restart-waybar # restart waybar in case user has waybar module for hyprsunset
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then
|
||||
hyprctl hyprsunset temperature $ON_TEMP
|
||||
notify-send -u low " Nightlight screen temperature"
|
||||
restart_nightlighted_waybar
|
||||
if [[ $enabled == "true" ]]; then
|
||||
NEW_ENABLED="false"
|
||||
TEMP=6500
|
||||
notify-send -u low " Nightlight DISABLED"
|
||||
else
|
||||
hyprctl hyprsunset temperature $OFF_TEMP
|
||||
notify-send -u low " Daylight screen temperature"
|
||||
restart_nightlighted_waybar
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user