From e5fbfa201ce89e70d091de589f773cee06cd476a Mon Sep 17 00:00:00 2001 From: piotr Date: Fri, 26 Mar 2021 00:57:28 +0100 Subject: [PATCH] Workspaces: add window icon #42 --- nwg_panel/config.py | 19 +++++++++++++++++++ nwg_panel/glade/config_sway_workspaces.glade | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/nwg_panel/config.py b/nwg_panel/config.py index af3fb5ef..9e636235 100644 --- a/nwg_panel/config.py +++ b/nwg_panel/config.py @@ -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 }, @@ -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 } @@ -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) @@ -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) diff --git a/nwg_panel/glade/config_sway_workspaces.glade b/nwg_panel/glade/config_sway_workspaces.glade index e008b280..cc0224ff 100644 --- a/nwg_panel/glade/config_sway_workspaces.glade +++ b/nwg_panel/glade/config_sway_workspaces.glade @@ -118,7 +118,7 @@ of workspaces to show - + True True