Update config
This commit is contained in:
parent
9f35c3997a
commit
46c65664f1
10 changed files with 748 additions and 0 deletions
33
config/dunst/scripts/low-battery.sh
Executable file
33
config/dunst/scripts/low-battery.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
# Low battery notifier
|
||||
|
||||
# Kill already running processes
|
||||
already_running="$(ps -fC 'grep' -N | grep 'low-battery.sh' | wc -l)"
|
||||
if [[ $already_running -gt 1 ]]; then
|
||||
pkill -f --older 1 'low-battery.sh'
|
||||
fi
|
||||
|
||||
while [[ 0 -eq 0 ]]; do
|
||||
battery_status="$(cat /sys/class/power_supply/BAT1/status)"
|
||||
battery_charge="$(cat /sys/class/power_supply/BAT1/capacity)"
|
||||
|
||||
if [[ $battery_status == 'Discharging' && $battery_charge -le 25 ]]; then
|
||||
if [[ $battery_charge -le 5 ]]; then
|
||||
notify-send --icon="${XDG_CONFIG_HOME:-~/.config}/dunst/images/Low-Battery.png" --urgency=critical "Battery critical!" "${battery_charge}%"
|
||||
sleep 180
|
||||
elif [[ $battery_charge -le 10 ]]; then
|
||||
notify-send --icon="${XDG_CONFIG_HOME:-~/.config}/dunst/images/Low-Battery2.png" --urgency=critical "Battery critical!" "${battery_charge}%"
|
||||
sleep 600
|
||||
elif [[ $battery_charge -le 15 ]]; then
|
||||
notify-send --icon="${XDG_CONFIG_HOME:-~/.config}/dunst/images/Low-Battery2.png" "Battery low!" "${battery_charge}%"
|
||||
sleep 600
|
||||
elif [[ $battery_charge -le 20 ]]; then
|
||||
notify-send --icon="${XDG_CONFIG_HOME:-~/.config}/dunst/images/Low-Battery2.png" "Battery low!" "${battery_charge}%"
|
||||
sleep 600
|
||||
else
|
||||
sleep 600
|
||||
fi
|
||||
else
|
||||
sleep 1200
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue