Merge e0c472932f3173f0cd02750c80f26463f8191ddd into 450745a467524a0bacdae2679deb370ac2a2e9d5

This commit is contained in:
Kelly Roberts 2022-11-20 08:44:00 +00:00 committed by GitHub
commit 14bb0dff35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

16
.local/bin/nightlight Executable file
View File

@ -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

View File

@ -4,13 +4,16 @@
# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). # to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.).
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) nightlight ;;
3) notify-send "🔋 Battery module" "🔋: discharging 3) notify-send "🔋 Battery module" "🔋: discharging
🛑: not charging 🛑: not charging
♻: stagnant charge ♻: stagnant charge
🔌: charging 🔌: charging
⚡: charged ⚡: charged
❗: battery very low! ❗: 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 ;; 4) xbacklight -inc 10 ;;
5) xbacklight -dec 10 ;; 5) xbacklight -dec 10 ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
@ -32,6 +35,9 @@ for battery in /sys/class/power_supply/BAT?*; do
capacity="$(cat "$battery/capacity" 2>&1)" capacity="$(cat "$battery/capacity" 2>&1)"
# Will make a warn variable if discharging and low # Will make a warn variable if discharging and low
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗" [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
# Show nightlight status
colortemp="$(xsct | cut -d' ' -f5)"
[ "$colortemp" -lt 6500 ] && night=" 🌙"
# Prints the info # Prints the info
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
done && printf "\\n" done && printf "$night" "\\n"