batperc script added added
This commit is contained in:
1 parent
81834ab96a
commit
1f5f80734d
1 file changed
+23
Executable
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
Green='\033[0;32m'
|
||||||
|
Color_off='\033[0m'
|
||||||
|
Red='\033[0;31m'
|
||||||
|
Yellow='\033[1;33m'
|
||||||
|
|
||||||
|
batfull=$(cat /sys/class/power_supply/$1/energy_full)
|
||||||
|
batnow=$(cat /sys/class/power_supply/$1/energy_now)
|
||||||
|
batperc=$((($batnow/($batfull/100))))
|
||||||
|
|
||||||
|
if [[ "$batperc" -le "20" ]]; then
|
||||||
|
printf "$Red$batperc$Color_off\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$batperc" -le "70" ]]; then
|
||||||
|
printf "$Yellow$batperc$Color_off\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "$Green$batperc$Color_off\n"
|
||||||
|
|
||||||
Reference in new issue
Block a user