show parent layout

This commit is contained in:
piotr
2021-03-27 04:11:40 +01:00
parent 9e92aa98d7
commit efbb966008
3 changed files with 37 additions and 3 deletions

View File

@@ -74,7 +74,8 @@ SKELETON_PANEL: dict = {
"show-name": True,
"name-length": 40,
"mark-autotiling": True,
"mark-content": True
"mark-content": True,
"show-layout": True
},
"clock": {
"format": "%a, %d. %b %H:%M:%S",
@@ -1038,7 +1039,8 @@ class EditorWrapper(object):
"show-name": True,
"name-length": 40,
"mark-autotiling": True,
"mark-content": True
"mark-content": True,
"show-layout": True
}
for key in defaults:
check_key(settings, key, defaults[key])
@@ -1078,6 +1080,9 @@ class EditorWrapper(object):
self.ws_mark_content = builder.get_object("mark-content")
self.ws_mark_content.set_active(settings["mark-content"])
self.ws_show_layout = builder.get_object("show-layout")
self.ws_show_layout.set_active(settings["show-layout"])
for item in self.scrolled_window.get_children():
item.destroy()
self.scrolled_window.add(grid)
@@ -1109,6 +1114,10 @@ class EditorWrapper(object):
if val is not None:
settings["mark-content"] = val
val = self.ws_show_layout.get_active()
if val is not None:
settings["show-layout"] = val
save_json(self.config, self.file)
def edit_scratchpad(self, *args):

View File

@@ -2,7 +2,7 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<!-- n-columns=3 n-rows=6 -->
<!-- n-columns=3 n-rows=7 -->
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -153,6 +153,25 @@ of workspaces to show</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="show-layout">
<property name="label" translatable="yes">Show layout</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">0</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>

View File

@@ -15,6 +15,7 @@ class SwayWorkspaces(Gtk.Box):
self.ws_num2lbl = {}
self.name_label = Gtk.Label("")
self.win_id = ""
self.win_pid = None
self.icon = Gtk.Image()
self.layout_icon = Gtk.Image()
self.icons_path = icons_path
@@ -151,6 +152,7 @@ class SwayWorkspaces(Gtk.Box):
ws_num = -1
win_name = ""
win_id = "" # app_id if available, else window_class
win_pid = None
layout = None
for ws in workspaces:
@@ -169,6 +171,8 @@ class SwayWorkspaces(Gtk.Box):
elif f.window_class:
win_id = f.window_class
win_pid = f.pid
for item in tree.descendants():
if item.type == "workspace":
# find non-empty workspaces
@@ -189,9 +193,11 @@ class SwayWorkspaces(Gtk.Box):
elif node.window_class:
win_id = node.window_class
layout = node.parent.layout
win_pid = node.pid
if not layout:
layout = f.parent.layout
return ws_num, win_name, win_id, non_empty, layout
def on_click(self, w, e, num):