From d34ac0d369957061eadedfff010108862fad8862 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 11 Jul 2025 03:43:23 +0545 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(dock,=20applicati?= =?UTF-8?q?ons):=20add=20option=20to=20hide=20apps=20in=20special=20worksp?= =?UTF-8?q?aces,=20refactor=20related=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/data.py | 2 ++ config/settings/constants.py | 1 + config/settings/gui.py | 29 +++++++++++++++++++++++++ modules/dock/components/applications.py | 24 ++++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/config/data.py b/config/data.py index 7dd2f0c..9682e56 100644 --- a/config/data.py +++ b/config/data.py @@ -70,6 +70,7 @@ if os.path.exists(CONFIG_FILE): WORKSPACE_DOTS = config.get("workspace_dots", False) WINDOW_SWITCHER_ITEMS_PER_ROW = config.get("window_switcher_items_per_row", 13) DOCK_HIDE_SPECIAL_WORKSPACE = config.get("dock_hide_special_workspace", True) + DOCK_HIDE_SPECIAL_WORKSPACE_APPS = config.get("dock_hide_special_workspace_apps", True) NOTIF_POS = config.get(NOTIF_POS_KEY, NOTIF_POS_DEFAULT) @@ -105,6 +106,7 @@ else: WINDOW_SWITCHER_ITEMS_PER_ROW = 13 NOTIF_POS = NOTIF_POS_DEFAULT DOCK_HIDE_SPECIAL_WORKSPACE = True + DOCK_HIDE_SPECIAL_WORKSPACE_APPS = True DOCK_COMPONENTS_VISIBILITY = { "workspace": True, diff --git a/config/settings/constants.py b/config/settings/constants.py index 447b621..1538693 100644 --- a/config/settings/constants.py +++ b/config/settings/constants.py @@ -59,6 +59,7 @@ DEFAULTS = { "dock_applications_visible": True, "dock_language_visible": True, "dock_hide_special_workspace": True, + "dock_hide_special_workspace_apps": True, "workspace_nums": False, "workspace_use_chinese_numerals": False, "workspace_dots": False, diff --git a/config/settings/gui.py b/config/settings/gui.py index ae2483f..6be3abd 100644 --- a/config/settings/gui.py +++ b/config/settings/gui.py @@ -465,6 +465,26 @@ class HyprConfGUI(Window): dock_hide_special_switch_container.add(self.dock_hide_special_switch) layout_grid.attach(dock_hide_special_switch_container, 3, 3, 1, 1) + # Add dock hide special workspace apps option + dock_hide_special_apps_label = Label( + label="Hide Special Workspace Apps", h_align="start", v_align="center" + ) + layout_grid.attach(dock_hide_special_apps_label, 2, 5, 1, 1) + dock_hide_special_apps_switch_container = Gtk.Box( + orientation=Gtk.Orientation.HORIZONTAL, + halign=Gtk.Align.START, + valign=Gtk.Align.CENTER, + ) + self.dock_hide_special_apps_switch = Gtk.Switch( + active=bind_vars.get("dock_hide_special_workspace_apps", True), + sensitive=self.dock_switch.get_active(), + ) + self.dock_hide_special_apps_switch.set_tooltip_text( + "Hide applications that are in special workspaces (scratchpad) from the dock" + ) + dock_hide_special_apps_switch_container.add(self.dock_hide_special_apps_switch) + layout_grid.attach(dock_hide_special_apps_switch_container, 3, 5, 1, 1) + notification_pos_label = Label( label="Notification Position", h_align="start", v_align="center" ) @@ -856,10 +876,12 @@ class HyprConfGUI(Window): self.dock_hover_switch.set_sensitive(is_active) self.dock_auto_hide_switch.set_sensitive(is_active) self.dock_hide_special_switch.set_sensitive(is_active) + self.dock_hide_special_apps_switch.set_sensitive(is_active) if not is_active: self.dock_hover_switch.set_active(False) self.dock_auto_hide_switch.set_active(False) self.dock_hide_special_switch.set_active(False) + self.dock_hide_special_apps_switch.set_active(False) def on_select_face_icon(self, widget): dialog = Gtk.FileChooserDialog( @@ -922,6 +944,9 @@ class HyprConfGUI(Window): current_bind_vars_snapshot["dock_hide_special_workspace"] = ( self.dock_hide_special_switch.get_active() ) + current_bind_vars_snapshot["dock_hide_special_workspace_apps"] = ( + self.dock_hide_special_apps_switch.get_active() + ) current_bind_vars_snapshot["dock_icon_size"] = int( self.icon_size_scale.get_value() ) @@ -1189,9 +1214,13 @@ class HyprConfGUI(Window): self.dock_hide_special_switch.set_active( utils.bind_vars.get("dock_hide_special_workspace", True) ) + self.dock_hide_special_apps_switch.set_active( + utils.bind_vars.get("dock_hide_special_workspace_apps", True) + ) self.dock_hover_switch.set_sensitive(self.dock_switch.get_active()) self.dock_auto_hide_switch.set_sensitive(self.dock_switch.get_active()) self.dock_hide_special_switch.set_sensitive(self.dock_switch.get_active()) + self.dock_hide_special_apps_switch.set_sensitive(self.dock_switch.get_active()) self.terminal_entry.set_text(utils.bind_vars["terminal_command"]) default_dock_theme_val = DEFAULTS.get("dock_theme", "Pills") diff --git a/modules/dock/components/applications.py b/modules/dock/components/applications.py index 5a56c1b..ffde4c8 100644 --- a/modules/dock/components/applications.py +++ b/modules/dock/components/applications.py @@ -278,6 +278,26 @@ class Applications(Box): normalized = normalized[: -len(suffix)] return normalized + 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_applications(self): for child in self.get_children(): self.remove(child) @@ -292,6 +312,10 @@ class Applications(Box): running_windows = {} for client in clients: + # Skip clients in special workspaces if the setting is enabled + if data.DOCK_HIDE_SPECIAL_WORKSPACE_APPS and self._is_special_workspace(client): + continue + class_name = client.get("class", "").lower() if class_name: if class_name not in running_windows: