diff --git a/.config/waybar/config b/.config/waybar/config index c861657..93f32e0 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -11,16 +11,24 @@ "modules-left": ["tray"], //"modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad", "custom/media"], //"modules-center": [""], - "modules-center": ["pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "battery", "idle_inhibitor"], - "modules-right": ["clock"], + "modules-center": ["pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "battery"], + "modules-right": ["idle_inhibitor", "custom/do-not-disturb", "clock"], //"modules-right": ["tray", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "clock", "custom/power"], // Modules configuration + "custom/do-not-disturb": { + "exec": "~/.config/waybar/get_dnd_status.sh", + "interval": "once", + "on-click":"dunstctl set-paused toggle", + "return-type": "json" + }, "idle_inhibitor": { "format": "{icon} ", "format-icons": { "activated": "", "deactivated": "" - } + }, + "tooltip-format-activated": "Sospensione disabilitata", + "tooltip-format-deactivated": "Sospensione abilitata" }, "tray": { //"icon-size": 18, diff --git a/.config/waybar/get_dnd_status.sh b/.config/waybar/get_dnd_status.sh new file mode 100755 index 0000000..b89378d --- /dev/null +++ b/.config/waybar/get_dnd_status.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Check if DND (do not disturb) is active using dunstctl and output JSON for Waybar +if dunstctl is-paused | grep -q 'true'; then + # DND is active + echo '{"text":"", "markup":"pango", "tooltip":"Disattiva il non disturbare", "class":"active"}' +else + # DND is inactive + echo '{"text":"", "markup":"pango", "tooltip":"Attiva il non disturbare", "class":"inactive"}' +fi + diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 05b53eb..b4c4ea3 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -89,6 +89,7 @@ button:hover { #mode, #idle_inhibitor, #scratchpad, +#custom-do-not-disturb, #mpd { border: 0px solid transparent; border-radius: 1em; @@ -232,6 +233,18 @@ label:focus { background-color: alpha(#eb4d4b, 0.2); } +#custom-do-not-disturb { + background-color: rgba(10, 10, 10, 0.2); + transition-property: background-color; + transition-duration: 1s; + padding: 0 0.5rem 0 0.8rem; +} + +#custom-do-not-disturb.active { + background-color: alpha(#ecf0f1, 0.8); + color: rgb(10, 10, 10); +} + #tray { background-color: rgba(10, 10, 10, 0.2); }