diff options
author | Shubham Saini <pryr@pryr.xyz> | 2021-05-12 12:53:13 +0000 |
---|---|---|
committer | Shubham Saini <pryr@pryr.xyz> | 2021-05-12 12:53:13 +0000 |
commit | 270398eb68c82701e0f1b6fa388ec180f0635bbe (patch) | |
tree | 0465029869e2d260d9b6897d01b831816e00ecb9 /bin | |
parent | 0b2a271f0bf57925b2b4b04fb3f35c929c3df8ba (diff) |
added bat for work machine
Diffstat (limited to 'bin')
-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 | ||