notifications

This commit is contained in:
2026-03-02 18:52:24 +01:00
parent 976d6cf554
commit 411e350482
15 changed files with 112 additions and 35 deletions

View File

@@ -1,6 +1,15 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
stat=$(cat /sys/class/power_supply/AC/online)
if [[ $bat -le 20 ]]; then
if [[ ! -f /tmp/battery_warning_send ]]; then
dunstify -u "critical" "Battery warning!" "Battery is at ${bat}% - please attach charger!"
touch /tmp/battery_warning_send
fi
else
rm -f /tmp/battery_warning_send
fi
if [ ! -d "/sys/class/power_supply/BAT0" ]; then
bat="100"
eww update batteryClass="batteryFull"
@@ -8,6 +17,7 @@ if [ ! -d "/sys/class/power_supply/BAT0" ]; then
elif [[ $stat == 1 ]]; then
eww update batteryClass="batteryCharging"
eww update batteryIcon=""
eww update batterOver="true"
elif [[ $bat -le 10 ]]; then
eww update batteryClass="batteryEmpty"
eww update batteryIcon=""