Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the "all workspaces" option to only show windows from the active workspace #31

Merged
merged 2 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nwg_panel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"])

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions nwg_panel/config/config
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"show-app-name": true,
"show-layout": true,
"workspace-buttons": false,
"all-workspaces": true,
"all-outputs": true
},
"sway-workspaces": {
Expand Down Expand Up @@ -206,6 +207,7 @@
"show-app-name": true,
"show-layout": true,
"workspace-buttons": false,
"all-workspaces": true,
"all-outputs": false
},
"sway-workspaces": {
Expand Down
13 changes: 13 additions & 0 deletions nwg_panel/glade/config_sway_taskbar.glade
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="all-workspaces">
<property name="label" translatable="yes">All workspaces</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="workspace-buttons">
<property name="label" translatable="yes">Workspaces as buttons</property>
Expand Down
11 changes: 7 additions & 4 deletions nwg_panel/modules/sway_taskbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down