wms/wms_batlarm.sh

26 lines
619 B
Bash
Raw Normal View History

2023-03-27 05:29:12 +02:00
#!/bin/sh
## alternating window border colors depending on battery charge ##
2023-03-27 06:38:42 +02:00
## this script depends on power.sh which is in the /others repo ##
2023-03-27 05:29:12 +02:00
. $HOME/.config/wms/wms_var
FREQ=0.5 # freq
COLORS="aa0000 $FG" # alternate colors
while :; do
read -r STATUS < /sys/class/power_supply/BAT0/status # battery status
if [ $STATUS = "Discharging" ]; then # if status discharging
for c in $COLORS; do # alternate border colors
chwb -c $c $(pfw)
sleep $FREQ
done
else # if not
chwb -c $FG $(pfw) # default border colors
break # exit loop
fi
done