Skip to content

Commit

Permalink
Workspaces: add window icon #42
Browse files Browse the repository at this point in the history
  • Loading branch information
nwg-piotr committed Mar 25, 2021
1 parent ce90e72 commit e5fbfa2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions nwg_panel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
},
"sway-workspaces": {
"numbers": ["1", "2", "3", "4", "5", "6", "7", "8"],
"show-icon": True,
"image-size": 16,
"show-name": True,
"name-length": 40
},
Expand Down Expand Up @@ -1029,6 +1031,8 @@ def edit_sway_workspaces(self, *args):
settings = self.panel["sway-workspaces"]
defaults = {
"numbers": [1, 2, 3, 4, 5, 6, 7, 8],
"show-icon": True,
"image-size": 16,
"show-name": True,
"name-length": 40
}
Expand All @@ -1046,9 +1050,18 @@ def edit_sway_workspaces(self, *args):
self.eb_workspaces_menu.set_text(text.strip())
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.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.set_numeric(True)
adj = Gtk.Adjustment(value=0, lower=1, upper=256, step_increment=1, page_increment=10, page_size=1)
Expand All @@ -1066,10 +1079,16 @@ def update_sway_workspaces(self):
if val:
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()
if val is not None:
settings["show-name"] = val

settings["image-size"] = int(self.ws_image_size.get_value())

settings["name-length"] = int(self.ws_name_length.get_value())

save_json(self.config, self.file)
Expand Down
2 changes: 1 addition & 1 deletion nwg_panel/glade/config_sway_workspaces.glade
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ of workspaces to show</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="icon-size">
<object class="GtkSpinButton" id="image-size">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
Expand Down

0 comments on commit e5fbfa2

Please sign in to comment.