wms/batlarm.sh

32 lines
586 B
Bash
Raw Normal View History

2024-01-21 04:05:04 +01:00
#!/bin/sh
## alternating window border colors depending on battery charge ##
## this script depends on power.sh which is in the /others repo ##
. /tmp/wms_var
# freq.
FREQ=0.5
# alternate colors.
COLORS="aa0000 $AC"
while true:; do
# battery status.
read -r STATUS < /sys/class/power_supply/BAT0/status
# if status discharging.
if [ "$STATUS" = "Discharging" ]; then
# alternate border colors.
for c in $COLORS; do
chwb -c $c $(pfw)
sleep $FREQ
done
else # if not
# default border colors.
chwb -c $AC $(pfw)
# exit loop.
break
fi
done