1
0
Fork 0
mirror of https://github.com/roles-ansible/role_akku_warning.git synced 2024-08-16 10:09:50 +02:00

update script: no popups during recharge

This commit is contained in:
L3D 2020-02-20 22:56:32 +01:00
parent 714731d4bf
commit 7b677ca528
Signed by: l3d
GPG key ID: CD08445BFF4313D1

View file

@ -1,7 +1,9 @@
#!/bin/bash
power="$((`cat /sys/class/power_supply/BAT0/energy_now` * 100 / `cat /sys/class/power_supply/BAT0/energy_full_design`))"
charging="$(cat /sys/class/power_supply/BAT0/status)"
if [ $charging == 'Discharging' ]; then
if (( $power < 25 && $power > 15 )); then
zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0
elif (( $power < 15 && $power > 9 )); then
@ -11,3 +13,4 @@ elif (( $power < 9 && $power > 5 )); then
elif (( $power < 5 )); then
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nRECHARGE!\nNOW!" --display=:0.0
fi
fi