summaryrefslogtreecommitdiff
path: root/bin/.bin/bat
blob: 473c7e2aadb35b781e42608a7e1109938e7f398d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
while true
do
    battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
    state=$(cat /sys/class/power_supply/BAT0/status)
    if [ $state == "Charging" ]; then
       echo -e +$battery_level%
    else
       echo -e $battery_level%
    fi
    sleep 3
done