mirror of
https://github.com/basecamp/omarchy.git
synced 2025-08-03 23:29:23 +00:00
Extract function
This commit is contained in:
@ -7,16 +7,19 @@ OFF_TEMP=6500
|
|||||||
# Query the current temperature
|
# Query the current temperature
|
||||||
CURRENT_TEMP=$(hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+')
|
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
|
if [[ "$CURRENT_TEMP" == "$OFF_TEMP" ]]; then
|
||||||
hyprctl hyprsunset temperature $ON_TEMP
|
hyprctl hyprsunset temperature $ON_TEMP
|
||||||
notify-send " Nightlight On"
|
notify-send " Nightlight On"
|
||||||
if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then
|
restart_nightlighted_waybar
|
||||||
omarchy-restart-waybar # restart waybar in case user has waybar module for hyprsunset
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
hyprctl hyprsunset temperature $OFF_TEMP
|
hyprctl hyprsunset temperature $OFF_TEMP
|
||||||
notify-send " Nightlight Off"
|
notify-send " Nightlight Off"
|
||||||
if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then
|
restart_nightlighted_waybar
|
||||||
omarchy-restart-waybar # restart waybar in case user has waybar module for hyprsunset
|
fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
Reference in New Issue
Block a user