Add Hyprsunset for Blue Light Filtering / Nightlight (#447)

* install hyprsunset when installing other hypr packages

* add hyprsunset to autostart

* add default hyprsunset config to make it do nothing by default

* waybar: add hyprsunset shortcut next to bluetooth shortcut to quickly toggle blue light filtering

* waybar: fix icon switching for hyprsunset widget

* add migration for hyprsunset

* waybar: rename "Blue Light Filter" to "Nightlight"

* waybar: make nightlight module appear next to bluetooth module

* waybar: do not include nightlight module by default

* add omarchy-toggle-nightlight script

* add default keybinding for toggling hyprsunset nightlight (SUPER + CTRL + N)

* waybar: remove nightlight module from config entirely

* waybar: remove nightlight from css

* update hyprsunset migration to skip yay install if already installed

* omarchy-toggle-nightlight: use `omarchy-restart-waybar` script instead of pkill with -SIG

* omarchy-toggle-nightlight: only restart waybar if nightlight is in the waybar config

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
Jaxon Wright
2025-08-03 04:26:59 -04:00
committed by GitHub
parent 3a5ef9d841
commit 3fb1bf9759
6 changed files with 40 additions and 1 deletions

22
bin/omarchy-toggle-nightlight Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Default temperature values
ON_TEMP=4000
OFF_TEMP=6500
# 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
notify-send " Nightlight On"
if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then
omarchy-restart-waybar # restart waybar in case user has waybar module for hyprsunset
fi
else
hyprctl hyprsunset temperature $OFF_TEMP
notify-send " Nightlight Off"
if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then
omarchy-restart-waybar # restart waybar in case user has waybar module for hyprsunset
fi
fi

View File

@ -0,0 +1,6 @@
# Makes hyprsunset do nothing to the screen by default
# Without this, the default applies some tint to the monitor
profile {
time = 00:00
identity = true
}

View File

@ -2,6 +2,7 @@ exec-once = uwsm app -- hypridle
exec-once = uwsm app -- mako
exec-once = uwsm app -- waybar
exec-once = uwsm app -- fcitx5
exec-once = uwsm app -- hyprsunset
exec-once = uwsm app -- swaybg -i ~/.config/omarchy/current/background -m fill
exec-once = uwsm app -- swayosd-server
exec-once = uwsm app -- walker --gapplication-service

View File

@ -18,6 +18,9 @@ bind = SUPER, ESCAPE, exec, ~/.local/share/omarchy/bin/omarchy-menu-power
# Toggle idling
bind = SUPER CTRL, I, exec, ~/.local/share/omarchy/bin/omarchy-toggle-idle
# Toggle nightlight
bind = SUPER CTRL, N, exec, ~/.local/share/omarchy/bin/omarchy-toggle-nightlight
# Control Apple Display brightness
bind = CTRL, F1, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness -5000
bind = CTRL, F2, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness +5000

View File

@ -1,6 +1,6 @@
#!/bin/bash
yay -S --noconfirm --needed \
hyprland hyprshot hyprpicker hyprlock hypridle polkit-gnome hyprland-qtutils \
hyprland hyprshot hyprpicker hyprlock hypridle hyprsunset polkit-gnome hyprland-qtutils \
walker-bin libqalculate waybar mako swaybg swayosd \
xdg-desktop-portal-hyprland xdg-desktop-portal-gtk

7
migrations/1754109724.sh Normal file
View File

@ -0,0 +1,7 @@
echo "Add hyprsunset blue light filter"
if ! command -v hyprsunset &>/dev/null; then
yay -S --noconfirm --needed hyprsunset
fi
cp -r ~/.local/share/omarchy/config/hypr/hyprsunset.conf ~/.config/hypr/
pkill hyprsunset
setsid uwsm app -- hyprsunset &>/dev/null &