dotfiles/bin/batmon
2024-09-13 22:06:26 +05:00

24 lines
433 B
Bash
Executable file

#!/usr/bin/env bash
monitor() {
cap=$(cat /sys/class/power_supply/bms/capacity)
fcs=$(cat /sys/class/power_supply/ln8000-charger/status)
scs=$(cat /sys/class/power_supply/pm8150b-charger/status)
[ "$fcs" == "Charging" ] && {
echo -ne "${cap}%++\n"
return 0
}
[ "$scs" == "Charging" ] && {
echo -ne "${cap}%+\n"
return 0
}
echo -ne "${cap}%\n"
return 0
}
while true; do
monitor
sleep 10
done