mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Merge e0c472932f3173f0cd02750c80f26463f8191ddd into 450745a467524a0bacdae2679deb370ac2a2e9d5
This commit is contained in:
commit
14bb0dff35
16
.local/bin/nightlight
Executable file
16
.local/bin/nightlight
Executable 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
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user