Add low battery script for notificatio nusing cron job
This commit is contained in:
parent
590af88d27
commit
7605593b81
16
.config/cron/battery_notifier.sh
Executable file
16
.config/cron/battery_notifier.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
battery_level=$(acpi -b | grep -P -o -m1 "[0-9]+(?=%)")
|
||||
|
||||
if [ $battery_level -le 5 ]
|
||||
then
|
||||
/usr/bin/notify-send "Battery level critical" "Battery level critically low, plug to avoid shutdown" --urgency=critical
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $battery_level -le 15 ]
|
||||
then
|
||||
/usr/bin/notify-send "Battery low" "Battery level dropped under 15%"
|
||||
exit
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user