feat: dim other monitors workspaces

This commit is contained in:
2026-05-03 19:05:46 +02:00
parent aee5be7f39
commit fb206667c4
3 changed files with 20 additions and 0 deletions

View File

@@ -290,6 +290,11 @@ tooltip>* {{
background-color: #{colors["base08"]};
}}
/* Workspace shown on a different monitor than this bar — dim it. */
#workspaces>button.foreign {{
opacity: 0.45;
}}
#workspaces>button>label {{
font-size: 0px;
}}

View File

@@ -39,6 +39,10 @@
animation: urgent-blink 1s infinite;
}
#workspaces>button.foreign {
opacity: 0.45;
}
@keyframes urgent-blink {
0% { opacity: 1.0; }
50% { opacity: 0.5; }

View File

@@ -61,6 +61,9 @@ class FensterWorkspaceButton(Button):
def set_urgent(self, urgent: bool):
self._toggle_class("urgent", urgent)
def set_foreign(self, foreign: bool):
self._toggle_class("foreign", foreign)
class FensterWorkspaces(Box):
"""Container widget showing a fixed set of workspace bubbles (1..N)."""
@@ -149,11 +152,13 @@ class FensterWorkspaces(Box):
button.set_visible_other(False)
button.set_urgent(False)
button.set_empty(True)
button.set_foreign(False)
continue
focused = bool(ws.get("focused"))
visible = bool(ws.get("visible"))
urgent = bool(ws.get("urgent"))
ws_output = ws.get("output")
window_count = ws.get("window_count", 0)
button.set_active(focused)
@@ -161,6 +166,12 @@ class FensterWorkspaces(Box):
button.set_visible_other(visible and not focused)
button.set_urgent(urgent)
button.set_empty(window_count == 0)
# Workspace currently shown on a different output than this bar's.
button.set_foreign(
self._output is not None
and ws_output is not None
and ws_output != self._output
)
self.show_all()