wms/opt/wms_batlarm.sh

33 lines
625 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 ##
2024-02-26 05:32:24 +01:00
# wms_batlarm.sh by @root_informatica.
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
2024-02-16 04:10:35 +01:00
# freq.
FREQ=0.5
# alternate colors.
COLORS="aa0000 $AC"
2023-03-27 05:29:12 +02:00
2024-02-16 04:10:35 +01:00
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
2023-03-27 05:29:12 +02:00
chwb -c $c $(pfw)
sleep $FREQ
done
else # if not
2024-02-16 04:10:35 +01:00
# default border colors.
chwb -c $AC $(pfw)
# exit loop.
break
2023-03-27 05:29:12 +02:00
fi
done