From c965882733855338fc0cb26edfa38c35a6626be5 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 20 Jul 2025 22:20:18 +0545 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(switcher):=20filt?= =?UTF-8?q?er=20out=20hidden=20windows=20and=20special=20workspace=20clien?= =?UTF-8?q?ts=20in=20update=5Fwindows=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/switcher.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/switcher.py b/modules/switcher.py index 246c39d..784e92b 100644 --- a/modules/switcher.py +++ b/modules/switcher.py @@ -67,6 +67,26 @@ class ApplicationSwitcher(Window): self.hide() self.ungrab_keyboard() + def _is_special_workspace(self, client): + """Check if a client is in a special workspace""" + if "workspace" not in client: + return False + + workspace = client["workspace"] + if "name" in workspace: + workspace_name = str(workspace["name"]) + # Special workspaces typically start with "special:" or have negative IDs + if workspace_name.startswith("special:"): + return True + + if "id" in workspace: + workspace_id = workspace["id"] + # Special workspaces have negative IDs + if workspace_id < 0: + return True + + return False + def update_windows(self) -> None: for child in self.view.get_children(): self.view.remove(child) @@ -76,7 +96,18 @@ class ApplicationSwitcher(Window): if not clients_data: return clients = json.loads(clients_data.decode("utf-8")) - self.windows = [c for c in clients if not c.get("hidden", False)] + + # Filter out hidden windows and optionally special workspace windows + filtered_windows = [] + for c in clients: + if c.get("hidden", False): + continue + # Skip clients in special workspaces if the setting is enabled + if data.DOCK_HIDE_SPECIAL_WORKSPACE_APPS and self._is_special_workspace(c): + continue + filtered_windows.append(c) + + self.windows = filtered_windows active_data = self.conn.send_command("j/activewindow").reply active_window = (