20 lines
657 B
Bash
20 lines
657 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
source ./battery-common-lib.sh
|
||
|
|
||
|
set_capacity
|
||
|
|
||
|
if [[ ${bat_status}=="Discharging" && ${capacity} -le 10 ]]; then
|
||
|
echo "Battery alert - ${capacity}%"
|
||
|
notify-send \
|
||
|
--icon="/usr/share/icons/Adwaita/64x64/status/battery-level-${cap}-symbolic.symbolic.png" \
|
||
|
"Critical battery" \
|
||
|
"Only ${capacity}% battery remaining"
|
||
|
elif [[ ${bat_status}=="Discharging" && ${capacity} -le 20 ]]; then
|
||
|
echo "Battery alert - ${capacity}%"
|
||
|
notify-send \
|
||
|
--icon="/usr/share/icons/Adwaita/64x64/status/battery-level-${cap}-symbolic.symbolic.png" \
|
||
|
"Low battery" \
|
||
|
"Only ${capacity}% battery remaining"
|
||
|
fi
|