sway: add DND toggle in sway and waybar

This commit is contained in:
Fabio Scotto di Santolo
2026-05-17 21:58:50 +02:00
parent 0aafd5d727
commit 6bb1895201
3 changed files with 24 additions and 1 deletions

View File

@@ -170,6 +170,9 @@ bindsym $mod+Shift+v exec pavucontrol
# File manager # File manager
bindsym $mod+Shift+f exec thunar bindsym $mod+Shift+f exec thunar
# Do not disturb (dunst pause toggle)
bindsym $mod+Shift+d exec dunstctl set-paused toggle
# Manual lock screen # Manual lock screen
bindsym $mod+Shift+x exec ~/.config/sway/scripts/lockscreen bindsym $mod+Shift+x exec ~/.config/sway/scripts/lockscreen

View File

@@ -6,7 +6,7 @@
"modules-left": ["sway/workspaces"], "modules-left": ["sway/workspaces"],
"modules-center": [], "modules-center": [],
"modules-right": ["cpu", "memory", "disk", "temperature", "backlight", "network", "pulseaudio", "battery", "tray", "clock", "custom/power"], "modules-right": ["cpu", "memory", "disk", "temperature", "backlight", "network", "pulseaudio", "battery", "tray", "clock", "custom/dnd", "custom/power"],
"sway/workspaces": { "sway/workspaces": {
"disable-scroll": true, "disable-scroll": true,
@@ -99,6 +99,14 @@
"spacing": 6 "spacing": 6
}, },
"custom/dnd": {
"exec": "dunstctl is-paused | grep -q true && echo '{\"text\":\"󰂛\",\"class\":\"paused\"}' || echo '{\"text\":\"󰂚\",\"class\":\"\"}'",
"return-type": "json",
"interval": 2,
"on-click": "dunstctl set-paused toggle",
"tooltip": false
},
"custom/power": { "custom/power": {
"format": "⏻", "format": "⏻",
"tooltip": false, "tooltip": false,

View File

@@ -44,6 +44,7 @@ window#waybar {
#pulseaudio, #pulseaudio,
#battery, #battery,
#tray, #tray,
#custom-dnd,
#custom-power { #custom-power {
padding: 0 8px; padding: 0 8px;
} }
@@ -67,6 +68,17 @@ window#waybar {
#tray { padding: 0 6px; } #tray { padding: 0 6px; }
#custom-dnd {
color: #8e8e9a;
font-size: 11pt;
}
#custom-dnd.paused {
color: #e0af68;
}
#custom-dnd:hover {
background-color: rgba(224, 175, 104, 0.15);
}
#custom-power { #custom-power {
color: #c7162b; color: #c7162b;
padding: 0 10px; padding: 0 10px;