update batperc and batpercd
This commit is contained in:
1 parent
498d1f45d0
commit
edfde04ba9
2 files changed
+17
-13
No files matched your search
+8
-5
@@ -7,13 +7,12 @@ Yellow='\033[1;33m'
|
||||
|
||||
batteries=$(ls /sys/class/power_supply/ | grep BAT)
|
||||
|
||||
if [[ "$batteries" == "" ]]; then
|
||||
printf "$Yellow**$Red error:$Color_off no battery found\n"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
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)
|
||||
@@ -33,6 +32,10 @@ case "$1" in
|
||||
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)
|
||||
|
||||
+9
-8
@@ -4,12 +4,13 @@ batperc=$(~/dotfiles/bin/batperc -j)
|
||||
|
||||
echo $batperc
|
||||
|
||||
while true; do
|
||||
for i in $batperc; do
|
||||
if [[ "$i" -le "20" ]]; then
|
||||
notify-send "Battery low: $i%" -u critical
|
||||
sleep 60
|
||||
fi
|
||||
if [[ "$batperc" != "no" ]]; then
|
||||
while true; do
|
||||
for i in $batperc; do
|
||||
if [[ "$i" -le "20" ]]; then
|
||||
notify-send "Battery low: $i%" -u critical
|
||||
sleep 60
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
Reference in new issue
Block a user