feat: add do not disturb toggle

refactor: move idle inhibitor and do not disturb module to the right
This commit is contained in:
2025-09-06 02:21:16 +02:00
parent 54e3820d96
commit 9cd50c2318
3 changed files with 35 additions and 3 deletions

View File

@@ -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": "<span size='medium'>{icon} </span>",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tooltip-format-activated": "Sospensione disabilitata",
"tooltip-format-deactivated": "Sospensione abilitata"
},
"tray": {
//"icon-size": 18,

View File

@@ -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":"<span size=\"large\"> </span>", "markup":"pango", "tooltip":"Disattiva il non disturbare", "class":"active"}'
else
# DND is inactive
echo '{"text":"<span size=\"large\"> </span>", "markup":"pango", "tooltip":"Attiva il non disturbare", "class":"inactive"}'
fi

View File

@@ -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);
}