summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.scripts/battery4
1 files changed, 2 insertions, 2 deletions
diff --git a/.scripts/battery b/.scripts/battery
index 41a7142..a99796e 100755
--- a/.scripts/battery
+++ b/.scripts/battery
@@ -33,9 +33,9 @@ for battery in /sys/class/power_supply/BAT?*; do
*) exit 1 ;;
esac
# Will make a warn variable if discharging and low
- [ "$(cat "$battery/status" 2>&1)" = "Discharging" ] && [ "$capacity" -le 25 ] && warn="❗" && dunstify "Critical Battery" "Charge Immediately" -u critical -i battery-quarter
+ [ "$(cat "$battery/status" 2>&1)" = "Discharging" ] && [ "$capacity" -le 25 ] && warn="❗" && [ -n "$(pgrep dunst)" ] && dunstify "Critical Battery" "Charge Immediately" -u critical -i battery-quarter
#parse json file in future and close the persistent Critical Battery notification
- [ "$status" = " " ] && [ "$capacity" -le 25 ] && [ $(dunstctl count displayed) == 1 ] && dunstctl close
+ [ "$status" = " " ] && [ "$capacity" -le 25 ] && [ -n "$(pgrep dunst)" ] && [ "$(dunstctl count displayed)" = 1 ] && dunstctl close
# Prints the info
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
done && printf "\\n"