1
0
Fork 0
forked from ahurac/dotfiles
ahuarc-dotfiles/bin/batstat

12 lines
364 B
Text
Raw Normal View History

2024-04-07 00:50:32 +02:00
#!/usr/bin/env sh
set -e
battery_capacity=$(cat "/sys/class/power_supply/${1}/capacity")
if [ "$battery_capacity" -lt 25 ]; then echo critical
elif [ "$battery_capacity" -lt 50 ]; then echo low
elif [ "$battery_capacity" -lt 75 ]; then echo medium
elif [ "$battery_capacity" -lt 100 ]; then echo high
else echo full
fi