Files
arthur-os/bin/omarchy-toggle-nightlight
d2a4cc0c4d Add omarchy CLI (#5477)
* Add omarchy CLI

* Remove outdated or internal

* Add bash completions for command

* Add omarchy command documentation

* Add missing docs

* Correct to what's now right

* Fix tests

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
2026-05-01 17:40:22 +02:00

33 lines
900 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]+')
restart_nightlighted_waybar() {
if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then
omarchy-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
else
hyprctl hyprsunset temperature $OFF_TEMP
notify-send -u low " Daylight screen temperature"
restart_nightlighted_waybar
fi