Add custom dunst module
This commit is contained in:
parent
686999de7a
commit
4ed968beb0
2 changed files with 20 additions and 12 deletions
|
@ -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": {
|
||||
|
|
15
usr/share/sway/scripts/dunst.sh
Executable file
15
usr/share/sway/scripts/dunst.sh
Executable 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
|
Loading…
Add table
Reference in a new issue