initial commit
This commit is contained in:
20
battery-timer.sh
Executable file
20
battery-timer.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
LOW_THRESHOLD=15
|
||||
CRITICAL_THRESHOLD=5
|
||||
|
||||
charge=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
state=$(cat /sys/class/power_supply/ACAD/online)
|
||||
|
||||
echo "charging: $(state)"
|
||||
|
||||
if [[ "$state" == "0" ]]; then
|
||||
if [[ $charge -le $CRITICAL_THRESHOLD ]]; then
|
||||
echo "critical"
|
||||
notify-send -t 10000 -u critical "Battery critically low! ($charge%)"
|
||||
elif [[ $charge -le $LOW_THRESHOLD ]]; then
|
||||
echo "low"
|
||||
notify-send -u normal "Battery low ($charge%)"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user