Skip to content

Commit

Permalink
Merge pull request #46 from nwg-piotr/workspaces
Browse files Browse the repository at this point in the history
Workspaces: final touch ;)
  • Loading branch information
nwg-piotr authored Mar 25, 2021
2 parents 05ff376 + 9863316 commit 7e033dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nwg_panel/modules/sway_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def build_box(self):
eb.set_property("name", "task-box")

if self.settings["show-name"]:
box.pack_start(self.name_label, False, False, 0)
self.pack_start(self.name_label, False, False, 6)

self.show_all()

Expand Down Expand Up @@ -76,6 +76,7 @@ def refresh(self):
return True

def find_focused(self):
tree = self.i3.get_tree()
workspaces = self.i3.get_workspaces()
ws_num = -1
win_name = ""
Expand All @@ -89,4 +90,10 @@ def find_focused(self):
if f.type == "con" and f.name and str(f.parent.workspace().num) in self.settings["numbers"]:
win_name = f.name[:self.settings["name-length"]]

for item in tree.descendants():
if item.type == "workspace":
for node in item.floating_nodes:
if str(node.workspace().num) in self.settings["numbers"] and node.focused:
win_name = node.name

return ws_num, win_name

0 comments on commit 7e033dc

Please sign in to comment.