Files
arthur-os/bin/omarchy-toggle-nightlight
T

23 lines
526 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Toggle nightlight screen temperature
# omarchy:examples=omarchy toggle nightlight
ON_TEMP=4000
OFF_TEMP=6000
# Ensure hyprsunset is running
if ! pgrep -x hyprsunset; then
setsid uwsm-app -- hyprsunset &
sleep 1 # Give it time to register
fi
# Query the current temperature
CURRENT_TEMP=$(hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+')
if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then
hyprctl hyprsunset temperature $ON_TEMP
else
hyprctl hyprsunset temperature $OFF_TEMP
fi