2019-04-07 18:52:35 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
power="$((`cat /sys/class/power_supply/BAT0/energy_now` * 100 / `cat /sys/class/power_supply/BAT0/energy_full_design`))"
|
2020-02-20 22:56:32 +01:00
|
|
|
charging="$(cat /sys/class/power_supply/BAT0/status)"
|
2019-04-07 18:52:35 +02:00
|
|
|
|
2020-02-20 22:56:32 +01:00
|
|
|
if [ $charging == 'Discharging' ]; then
|
|
|
|
if (( $power < 25 && $power > 15 )); then
|
2019-04-07 18:52:35 +02:00
|
|
|
zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0
|
2020-02-20 22:56:32 +01:00
|
|
|
elif (( $power < 15 && $power > 9 )); then
|
2019-08-31 15:05:07 +02:00
|
|
|
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
|
2020-02-20 22:56:32 +01:00
|
|
|
elif (( $power < 9 && $power > 5 )); then
|
2019-04-07 18:52:35 +02:00
|
|
|
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0
|
2020-02-20 22:56:32 +01:00
|
|
|
elif (( $power < 5 )); then
|
2019-04-07 18:52:35 +02:00
|
|
|
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nRECHARGE!\nNOW!" --display=:0.0
|
2020-02-20 22:56:32 +01:00
|
|
|
fi
|
2019-04-07 18:52:35 +02:00
|
|
|
fi
|