new SwayWorkspaces settings added

This commit is contained in:
piotr
2021-03-25 04:41:32 +01:00
parent 02c4a2fdd2
commit 0880d32f58
2 changed files with 25 additions and 4 deletions

View File

@@ -67,7 +67,11 @@ SKELETON_PANEL: dict = {
"all-workspaces": True,
"all-outputs": False
},
"sway-workspaces": {"numbers": ["1", "2", "3", "4", "5", "6", "7", "8"]},
"sway-workspaces": {
"numbers": ["1", "2", "3", "4", "5", "6", "7", "8"],
"show-name": True,
"name-length": 40
},
"clock": {
"format": "%a, %d. %b %H:%M:%S",
"tooltip-text": "",
@@ -1024,7 +1028,9 @@ class EditorWrapper(object):
check_key(self.panel, "sway-workspaces", {})
settings = self.panel["sway-workspaces"]
defaults = {
"numbers": [1, 2, 3, 4, 5, 6, 7, 8]
"numbers": [1, 2, 3, 4, 5, 6, 7, 8],
"show-name": True,
"name-length": 40
}
for key in defaults:
check_key(settings, key, defaults[key])
@@ -1040,6 +1046,15 @@ class EditorWrapper(object):
self.eb_workspaces_menu.set_text(text.strip())
self.eb_workspaces_menu.connect("changed", validate_workspaces)
self.ws_show_name = builder.get_object("show-name")
self.ws_show_name.set_active(settings["show-name"])
self.ws_name_length = builder.get_object("name-length")
self.ws_name_length.set_numeric(True)
adj = Gtk.Adjustment(value=0, lower=1, upper=256, step_increment=1, page_increment=10, page_size=1)
self.ws_name_length.configure(adj, 1, 0)
self.ws_name_length.set_value(settings["name-length"])
for item in self.scrolled_window.get_children():
item.destroy()
self.scrolled_window.add(grid)
@@ -1051,6 +1066,12 @@ class EditorWrapper(object):
if val:
settings["numbers"] = val.split()
val = self.ws_show_name.get_active()
if val is not None:
settings["show-name"] = val
settings["name-length"] = int(self.ws_name_length.get_value())
save_json(self.config, self.file)
def edit_scratchpad(self, *args):

View File

@@ -70,7 +70,7 @@ of workspaces to show</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<object class="GtkSpinButton" id="name-length">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
@@ -80,7 +80,7 @@ of workspaces to show</property>
</packing>
</child>
<child>
<object class="GtkCheckButton">
<object class="GtkCheckButton" id="show-name">
<property name="label" translatable="yes">Show focused window</property>
<property name="visible">True</property>
<property name="can-focus">True</property>