From 4ed968beb0b42810bd1544e6a65e5eaa245637eb Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Thu, 11 May 2023 22:03:51 +0400 Subject: [PATCH] Add custom dunst module --- etc/skel/.config/waybar/config.jsonc | 17 +++++------------ usr/share/sway/scripts/dunst.sh | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100755 usr/share/sway/scripts/dunst.sh diff --git a/etc/skel/.config/waybar/config.jsonc b/etc/skel/.config/waybar/config.jsonc index 331011a..0bcac9f 100644 --- a/etc/skel/.config/waybar/config.jsonc +++ b/etc/skel/.config/waybar/config.jsonc @@ -7,7 +7,7 @@ "modules-right": [ "custom/playerctl", "idle_inhibitor", - "custom/dnd", + "custom/dunst", "sway/language", "cpu", "memory", @@ -153,17 +153,10 @@ "on-click": "nwg-bar -x" }, - "custom/dnd": { - "interval": "once", - "return-type": "json", - "format": "{}{icon}", - "format-icons": { - "default": "", - "dnd": "" - }, - "on-click": "makoctl mode | grep 'do-not-disturb' && makoctl mode -r do-not-disturb || makoctl mode -a do-not-disturb; pkill -RTMIN+11 waybar", - "exec": "printf '{\"alt\":\"%s\",\"tooltip\":\"Notification mode: %s\"}' $(makoctl mode | grep -q 'do-not-disturb' && echo dnd || echo default) $(makoctl mode | tail -1)", - "signal": 11 + "custom/dunst": { + "exec": "/usr/share/sway/scripts/dunst.sh", + "on-click": "dunstctl set-paused toggle", + "restart-interval": 1, }, "tray": { diff --git a/usr/share/sway/scripts/dunst.sh b/usr/share/sway/scripts/dunst.sh new file mode 100755 index 0000000..87d2c7d --- /dev/null +++ b/usr/share/sway/scripts/dunst.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +COUNT=$(dunstctl count waiting) +ENABLED= +DISABLED= + +if [ $COUNT != 0 ]; then + DISABLED=" $COUNT" +fi + +if dunstctl is-paused | grep -q "false" ; then + echo $ENABLED +else + echo $DISABLED +fi