mirror of
https://github.com/SirTeddy99/sway-config.git
synced 2026-04-20 01:50:27 +00:00
battery-notify script
This commit is contained in:
parent
16cf74dffa
commit
5c394bfd80
2 changed files with 22 additions and 1 deletions
13
scripts/battery-notify.sh
Executable file
13
scripts/battery-notify.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
battery_status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
# Only warn when discharging (not plugged in)
|
||||
if [[ $battery_status == "Discharging" ]]; then
|
||||
if [[ $battery_level -le 15 ]]; then
|
||||
notify-send -u critical "⚠️ Battery Critical" "Only ${battery_level}% remaining! Plug in NOW!"
|
||||
elif [[ $battery_level -le 30 ]]; then
|
||||
notify-send -u normal "🔋 Battery Low" "Battery at ${battery_level}%. Consider plugging in soon."
|
||||
fi
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue