summaryrefslogtreecommitdiff
path: root/polybar/scripts/dunst-status.sh
diff options
context:
space:
mode:
authorDavid Moc <personal@cdatgoose.org>2026-05-24 11:48:07 +0200
committerDavid Moc <personal@cdatgoose.org>2026-05-24 11:48:07 +0200
commit5fb19f10389b70ee2389755106092a9ef6c64598 (patch)
tree969eb0466de581cb14aa09f751a95138620fc720 /polybar/scripts/dunst-status.sh
Go
Diffstat (limited to 'polybar/scripts/dunst-status.sh')
-rwxr-xr-xpolybar/scripts/dunst-status.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/polybar/scripts/dunst-status.sh b/polybar/scripts/dunst-status.sh
new file mode 100755
index 0000000..da23ddd
--- /dev/null
+++ b/polybar/scripts/dunst-status.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if ! command -v dunstctl >/dev/null 2>&1; then
+ echo "n/a"
+ exit 0
+fi
+
+paused="$(dunstctl is-paused 2>/dev/null || echo unavailable)"
+waiting="$(dunstctl count waiting 2>/dev/null || echo 0)"
+
+case "$paused" in
+ true)
+ if [ "$waiting" -gt 0 ] 2>/dev/null; then
+ echo "dnd $waiting"
+ else
+ echo "dnd"
+ fi
+ ;;
+ false)
+ echo "on"
+ ;;
+ *)
+ echo "off"
+ ;;
+esac