diff options
Diffstat (limited to 'bin/.bin/bat')
-rwxr-xr-x | bin/.bin/bat | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/.bin/bat b/bin/.bin/bat new file mode 100755 index 0000000..473c7e2 --- /dev/null +++ b/bin/.bin/bat | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/bash | ||
2 | while true | ||
3 | do | ||
4 | battery_level=$(cat /sys/class/power_supply/BAT0/capacity) | ||
5 | state=$(cat /sys/class/power_supply/BAT0/status) | ||
6 | if [ $state == "Charging" ]; then | ||
7 | echo -e +$battery_level% | ||
8 | else | ||
9 | echo -e $battery_level% | ||
10 | fi | ||
11 | sleep 3 | ||
12 | done | ||