diff --git a/.local/bin/nightlight b/.local/bin/nightlight new file mode 100755 index 00000000..6d4907fb --- /dev/null +++ b/.local/bin/nightlight @@ -0,0 +1,16 @@ +#!/bin/sh + +# requires xsct +# toggle for a "nightlight" color temperature +# edit value of settemp to your desired color temperature (minimum is 700) + +settemp="2700" +colortemp="$(xsct | cut -d' ' -f5)" + +if [ "$colortemp" -ge "6500" ]; then + notify-send "🌙 Night Light Enabled (${settemp}K)" + for i in $(seq 6500 -100 ${settemp}); do xsct $i; sleep 0.05; done +else + notify-send "☀️ Night Light Disabled" + for i in $(seq ${settemp} 100 6500); do xsct $i; sleep 0.05; done +fi diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index 93cbe088..ffb9a894 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -4,13 +4,16 @@ # to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). case $BLOCK_BUTTON in + 1) nightlight ;; 3) notify-send "🔋 Battery module" "🔋: discharging 🛑: not charging ♻: stagnant charge 🔌: charging ⚡: charged ❗: battery very low! -- Scroll to change adjust xbacklight." ;; +🌙: Night Light enabled +- Scroll to change adjust xbacklight. +- Click to activate Night Light." ;; 4) xbacklight -inc 10 ;; 5) xbacklight -dec 10 ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; @@ -32,6 +35,9 @@ for battery in /sys/class/power_supply/BAT?*; do capacity="$(cat "$battery/capacity" 2>&1)" # Will make a warn variable if discharging and low [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗" + # Show nightlight status + colortemp="$(xsct | cut -d' ' -f5)" + [ "$colortemp" -lt 6500 ] && night=" 🌙" # Prints the info printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn -done && printf "\\n" +done && printf "$night" "\\n"