Workspaces: add window icon #42

This commit is contained in:
piotr
2021-03-26 00:57:28 +01:00
parent ce90e72014
commit e5fbfa201c
2 changed files with 20 additions and 1 deletions

View File

@@ -69,6 +69,8 @@ SKELETON_PANEL: dict = {
}, },
"sway-workspaces": { "sway-workspaces": {
"numbers": ["1", "2", "3", "4", "5", "6", "7", "8"], "numbers": ["1", "2", "3", "4", "5", "6", "7", "8"],
"show-icon": True,
"image-size": 16,
"show-name": True, "show-name": True,
"name-length": 40 "name-length": 40
}, },
@@ -1029,6 +1031,8 @@ class EditorWrapper(object):
settings = self.panel["sway-workspaces"] settings = self.panel["sway-workspaces"]
defaults = { defaults = {
"numbers": [1, 2, 3, 4, 5, 6, 7, 8], "numbers": [1, 2, 3, 4, 5, 6, 7, 8],
"show-icon": True,
"image-size": 16,
"show-name": True, "show-name": True,
"name-length": 40 "name-length": 40
} }
@@ -1046,9 +1050,18 @@ class EditorWrapper(object):
self.eb_workspaces_menu.set_text(text.strip()) self.eb_workspaces_menu.set_text(text.strip())
self.eb_workspaces_menu.connect("changed", validate_workspaces) self.eb_workspaces_menu.connect("changed", validate_workspaces)
self.ws_show_icon = builder.get_object("show-icon")
self.ws_show_icon.set_active(settings["show-icon"])
self.ws_show_name = builder.get_object("show-name") self.ws_show_name = builder.get_object("show-name")
self.ws_show_name.set_active(settings["show-name"]) self.ws_show_name.set_active(settings["show-name"])
self.ws_image_size = builder.get_object("image-size")
self.ws_image_size.set_numeric(True)
adj = Gtk.Adjustment(value=0, lower=8, upper=129, step_increment=1, page_increment=10, page_size=1)
self.ws_image_size.configure(adj, 1, 0)
self.ws_image_size.set_value(settings["image-size"])
self.ws_name_length = builder.get_object("name-length") self.ws_name_length = builder.get_object("name-length")
self.ws_name_length.set_numeric(True) 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) adj = Gtk.Adjustment(value=0, lower=1, upper=256, step_increment=1, page_increment=10, page_size=1)
@@ -1066,10 +1079,16 @@ class EditorWrapper(object):
if val: if val:
settings["numbers"] = val.split() settings["numbers"] = val.split()
val = self.ws_show_icon.get_active()
if val is not None:
settings["show-icon"] = val
val = self.ws_show_name.get_active() val = self.ws_show_name.get_active()
if val is not None: if val is not None:
settings["show-name"] = val settings["show-name"] = val
settings["image-size"] = int(self.ws_image_size.get_value())
settings["name-length"] = int(self.ws_name_length.get_value()) settings["name-length"] = int(self.ws_name_length.get_value())
save_json(self.config, self.file) save_json(self.config, self.file)

View File

@@ -118,7 +118,7 @@ of workspaces to show</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="icon-size"> <object class="GtkSpinButton" id="image-size">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
</object> </object>