diff options
| author | ryukamish <[email protected]> | 2026-04-11 18:25:38 +0530 |
|---|---|---|
| committer | ryukamish <[email protected]> | 2026-04-11 18:25:38 +0530 |
| commit | b3474e85dcce03e7de0b4a4e30ff7fad1f38ee26 (patch) | |
| tree | bcfe42ad76a825c283eec653140ab4052f0b3017 /scripts/nightlight-toggle | |
| parent | 607891801fbf2051a0c9062d15a445dd238c1e1b (diff) | |
add: small bash scripts for added functionality
Diffstat (limited to 'scripts/nightlight-toggle')
| -rwxr-xr-x | scripts/nightlight-toggle | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/nightlight-toggle b/scripts/nightlight-toggle new file mode 100755 index 0000000..7e09303 --- /dev/null +++ b/scripts/nightlight-toggle @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +hyprland_nightlight_toggle() { + # Default temperature values + ON_TEMP=4500 + OFF_TEMP=6000 + # Ensure hyprsunset is running + if ! pgrep -x hyprsunset; then + 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 + notify-send " Nightlight screen temperature" + else + hyprctl hyprsunset temperature $OFF_TEMP + notify-send " Daylight screen temperature" + fi +} + +niri_nightlight_toggle() { + if pgrep -x wlsunset; then + killall wlsunset + notify-send " Daylight screen temperature" + else + setsid -f wlsunset -T 4500 + notify-send " Nightlight screen temperature" + fi +} + +case "$1" in +*niri) + niri_nightlight_toggle + ;; +*hyprland) + hyprland_nightlight_toggle + ;; +esac |
