wms/wms_batlarm.sh

26 lines
608 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
2023-08-08 04:42:24 +02:00
. /tmp/wms_var
2023-03-27 05:29:12 +02:00
FREQ=0.5 # freq
2023-05-10 01:23:59 +02:00
COLORS="aa0000 $AC" # alternate colors
2023-03-27 05:29:12 +02:00
while :; do
read -r STATUS < /sys/class/power_supply/BAT0/status # battery status
2023-08-26 06:55:35 +02:00
if [ "$STATUS" = "Discharging" ]; then # if status discharging
2023-03-27 05:29:12 +02:00
for c in $COLORS; do # alternate border colors
chwb -c $c $(pfw)
sleep $FREQ
done
else # if not
2023-05-10 01:23:59 +02:00
chwb -c $AC $(pfw) # default border colors
2023-03-27 05:29:12 +02:00
break # exit loop
fi
done