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:
parent
714731d4bf
commit
7b677ca528
1 changed files with 7 additions and 4 deletions
|
@ -1,13 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
power="$((`cat /sys/class/power_supply/BAT0/energy_now` * 100 / `cat /sys/class/power_supply/BAT0/energy_full_design`))"
|
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 (( $power < 25 && $power > 15 )); then
|
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
|
zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0
|
||||||
elif (( $power < 15 && $power > 9 )); then
|
elif (( $power < 15 && $power > 9 )); then
|
||||||
if (( RANDOM % 2 )); then zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0; else pulsemixer --set-volume 95; mpv {{ akku_sound_dest }} -fs --volume 130 --start 00:00:18 --vo=tct > /dev/null ; fi
|
if (( RANDOM % 2 )); then zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0; else pulsemixer --set-volume 95; mpv {{ akku_sound_dest }} -fs --volume 130 --start 00:00:18 --vo=tct > /dev/null ; fi
|
||||||
elif (( $power < 9 && $power > 5 )); then
|
elif (( $power < 9 && $power > 5 )); then
|
||||||
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0
|
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0
|
||||||
elif (( $power < 5 )); then
|
elif (( $power < 5 )); then
|
||||||
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nRECHARGE!\nNOW!" --display=:0.0
|
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nRECHARGE!\nNOW!" --display=:0.0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue