2023-08-18 19:38:09 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-11-27 23:31:36 +01:00
|
|
|
readonly ENABLED=''
|
|
|
|
readonly DISABLED='\uf1f6' # nf-fa-bell_slash
|
2023-08-18 19:38:09 +02:00
|
|
|
dbus-monitor path='/org/freedesktop/Notifications',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged' --profile |
|
|
|
|
while read -r _; do
|
|
|
|
PAUSED="$(dunstctl is-paused)"
|
|
|
|
if [ "$PAUSED" == 'false' ]; then
|
|
|
|
CLASS="enabled"
|
|
|
|
TEXT="$ENABLED"
|
|
|
|
else
|
|
|
|
CLASS="disabled"
|
|
|
|
TEXT="$DISABLED"
|
|
|
|
COUNT="$(dunstctl count waiting)"
|
|
|
|
if [ "$COUNT" != '0' ]; then
|
|
|
|
TEXT="$DISABLED ($COUNT)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
printf '{"text": "%s", "class": "%s"}\n' "$TEXT" "$CLASS"
|
|
|
|
done
|