summaryrefslogtreecommitdiff
path: root/.scripts
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-10-19 03:29:25 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-10-19 03:29:25 +0530
commit371d02c202c19e68d240729260e2e526a33e41ae (patch)
tree3bc3d00beddd2e48027bdd1a074f5e2942e91fdc /.scripts
parenta0298de68dcf476e88f67a338a40f4c7606d17e8 (diff)
making battery script dunst independent
Diffstat (limited to '.scripts')
-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"