diff options
Diffstat (limited to 'hypr/battery-notif.sh')
| -rw-r--r-- | hypr/battery-notif.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/hypr/battery-notif.sh b/hypr/battery-notif.sh index 5e477d8..4298192 100644 --- a/hypr/battery-notif.sh +++ b/hypr/battery-notif.sh @@ -1,2 +1,16 @@ -nix-env -iA nixpkgs.python3.psutil -python battery_warning.py +#!/usr/bin/env bash + +while true; do + status=$(cat /sys/class/power_supply/BAT1/status) + if [[ "$status" = "Discharging" ]]; then + battery=$(cat /sys/class/power_supply/BAT1/capacity) + if [[ battery -lt 15 ]]; then + notify-send -u critical Very Low Battery -i ~/.config/waybar/battery_low.png + elif [[ battery -lt 30 ]]; then + notify-send -u normal Low Battery -i ~/.config/waybar/battery_low.png + fi + fi + pid=$! + sleep 5 + kill $pid +done |
