diff --git a/nwg_panel/config.py b/nwg_panel/config.py index 42e4d4f6..7e5646c7 100644 --- a/nwg_panel/config.py +++ b/nwg_panel/config.py @@ -64,6 +64,7 @@ "show-app-name": True, "show-layout": True, "workspace-buttons": True, + "all-workspaces": True, "all-outputs": False }, "sway-workspaces": {"numbers": ["1", "2", "3", "4", "5", "6", "7", "8"]}, @@ -763,6 +764,7 @@ def edit_sway_taskbar(self, *args): "show-app-name": True, "show-layout": True, "workspace-buttons": True, + "all-workspaces": True, "all-outputs": False } for key in defaults: @@ -815,6 +817,9 @@ def edit_sway_taskbar(self, *args): self.workspace_buttons = builder.get_object("workspace-buttons") self.workspace_buttons.set_active(settings["workspace-buttons"]) + self.ckb_all_workspaces = builder.get_object("all-workspaces") + self.ckb_all_workspaces.set_active(settings["all-workspaces"]) + self.ckb_all_outputs = builder.get_object("all-outputs") self.ckb_all_outputs.set_active(settings["all-outputs"]) @@ -861,6 +866,10 @@ def update_sway_taskbar(self): if val is not None: settings["workspace-buttons"] = val + val = self.ckb_all_workspaces.get_active() + if val is not None: + settings["all-workspaces"] = val + val = self.ckb_all_outputs.get_active() if val is not None: settings["all-outputs"] = val diff --git a/nwg_panel/config/config b/nwg_panel/config/config index eb620ea5..67ee1713 100644 --- a/nwg_panel/config/config +++ b/nwg_panel/config/config @@ -90,6 +90,7 @@ "show-app-name": true, "show-layout": true, "workspace-buttons": false, + "all-workspaces": true, "all-outputs": true }, "sway-workspaces": { @@ -206,6 +207,7 @@ "show-app-name": true, "show-layout": true, "workspace-buttons": false, + "all-workspaces": true, "all-outputs": false }, "sway-workspaces": { diff --git a/nwg_panel/glade/config_sway_taskbar.glade b/nwg_panel/glade/config_sway_taskbar.glade index c931be84..d6c037be 100644 --- a/nwg_panel/glade/config_sway_taskbar.glade +++ b/nwg_panel/glade/config_sway_taskbar.glade @@ -21,6 +21,19 @@ 8 + + + All workspaces + True + True + False + True + + + 1 + 8 + + Workspaces as buttons diff --git a/nwg_panel/modules/sway_taskbar.py b/nwg_panel/modules/sway_taskbar.py index 95e5ab56..087a8e53 100644 --- a/nwg_panel/modules/sway_taskbar.py +++ b/nwg_panel/modules/sway_taskbar.py @@ -14,6 +14,7 @@ def __init__(self, settings, i3, position, display_name="", icons_path=""): check_key(settings, "image-size", 16) check_key(settings, "workspace-menu", [1, 2, 3, 4, 5, 6, 7, 8]) check_key(settings, "task-padding", 0) + check_key(settings, "all-workspaces", True) Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=settings["workspaces-spacing"]) self.settings = settings self.display_name = display_name @@ -55,15 +56,17 @@ def list_tree(self): def build_box(self): self.displays_tree = self.list_tree() + all_workspaces = self.settings["all-workspaces"] for display in self.displays_tree: for desc in display.descendants(): if desc.type == "workspace": self.ws_box = WorkspaceBox(desc, self.settings, self.autotiling) - for con in desc.descendants(): - if con.name or con.app_id: - win_box = WindowBox(con, self.settings, self.position, self.icons_path) - self.ws_box.pack_start(win_box, False, False, self.settings["task-padding"]) + if all_workspaces or desc.find_focused() is not None: + for con in desc.descendants(): + if con.name or con.app_id: + win_box = WindowBox(con, self.settings, self.position, self.icons_path) + self.ws_box.pack_start(win_box, False, False, self.settings["task-padding"]) self.pack_start(self.ws_box, False, False, 0) self.show_all()