Add custom dunst module

This commit is contained in:
Aleksey Samoilov 2023-05-11 22:03:51 +04:00
parent 686999de7a
commit 4ed968beb0
2 changed files with 20 additions and 12 deletions

View file

@ -7,7 +7,7 @@
"modules-right": [ "modules-right": [
"custom/playerctl", "custom/playerctl",
"idle_inhibitor", "idle_inhibitor",
"custom/dnd", "custom/dunst",
"sway/language", "sway/language",
"cpu", "cpu",
"memory", "memory",
@ -153,17 +153,10 @@
"on-click": "nwg-bar -x" "on-click": "nwg-bar -x"
}, },
"custom/dnd": { "custom/dunst": {
"interval": "once", "exec": "/usr/share/sway/scripts/dunst.sh",
"return-type": "json", "on-click": "dunstctl set-paused toggle",
"format": "{}{icon}", "restart-interval": 1,
"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
}, },
"tray": { "tray": {

15
usr/share/sway/scripts/dunst.sh Executable file
View file

@ -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