that's a bunch of cool new stuff

This commit is contained in:
2024-12-19 23:32:30 +01:00
parent ae3d29b0ee
commit ac51a31675
34 changed files with 864 additions and 517 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
readonly ENABLED=''
readonly DISABLED=''
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"
TOOLTIP="Notifications are on"
else
CLASS="disabled"
TEXT="$DISABLED"
TOOLTIP="Notifications are off"
COUNT="$(dunstctl count waiting)"
if [ "$COUNT" != '0' ]; then
TEXT="$DISABLED ($COUNT)"
fi
fi
printf '{"text": "%s", "class": "%s", "tooltip": "%s"}\n' "$TEXT" "$CLASS" "$TOOLTIP"
done