initial commit
This commit is contained in:
1 parent
d4234ebf6a
commit
f2ee1ea3ed
1017 files changed
-117961
No files matched your search
-48
@@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
Green='\033[0;32m'
|
||||
Color_off='\033[0m'
|
||||
Red='\033[0;31m'
|
||||
Yellow='\033[1;33m'
|
||||
|
||||
batteries=$(ls /sys/class/power_supply/ | grep BAT)
|
||||
|
||||
case "$1" in
|
||||
"-c")
|
||||
if [[ "$batteries" == "" ]]; then
|
||||
printf "$Yellow**$Red error:$Color_off no battery found\n"
|
||||
exit 1;
|
||||
fi
|
||||
for i in $batteries; do
|
||||
batfull=$(cat /sys/class/power_supply/$i/energy_full)
|
||||
batnow=$(cat /sys/class/power_supply/$i/energy_now)
|
||||
batperc=$((($batnow/($batfull/100))))
|
||||
|
||||
if [[ "$batperc" -le "20" ]]; then
|
||||
printf "$Yellow**$Color_off $i: $Red$batperc$Color_off\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$batperc" -le "70" ]]; then
|
||||
printf "$Yellow**$Color_off $i: $Yellow$batperc$Color_off\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "$Yellow**$Color_off $i: $Green$batperc$Color_off\n"
|
||||
done
|
||||
;;
|
||||
"-j")
|
||||
if [[ "$batteries" == "" ]]; then
|
||||
echo no
|
||||
exit 1;
|
||||
fi
|
||||
for i in $batteries; do
|
||||
batfull=$(cat /sys/class/power_supply/$i/energy_full)
|
||||
batnow=$(cat /sys/class/power_supply/$i/energy_now)
|
||||
batperc=$((($batnow/($batfull/100))))
|
||||
|
||||
printf "$batperc \n"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in new issue
Block a user