diff --git a/bar/modules/stylix.py b/bar/modules/stylix.py index a7aeb3f..07dba82 100644 --- a/bar/modules/stylix.py +++ b/bar/modules/stylix.py @@ -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; }} diff --git a/bar/styles/workspaces.css b/bar/styles/workspaces.css index a3fb796..abeb75f 100644 --- a/bar/styles/workspaces.css +++ b/bar/styles/workspaces.css @@ -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; } diff --git a/bar/widgets/fenster.py b/bar/widgets/fenster.py index 4ec6c6c..c54c4e0 100644 --- a/bar/widgets/fenster.py +++ b/bar/widgets/fenster.py @@ -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()