From 8e3f3e2cfee5dfc0a2579d29231fcbc80ea0de12 Mon Sep 17 00:00:00 2001 From: piotr Date: Tue, 13 Apr 2021 00:56:06 +0200 Subject: [PATCH 1/2] Added "All" option to panel output selection #48 --- nwg_panel/config.py | 7 +++++-- nwg_panel/main.py | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/nwg_panel/config.py b/nwg_panel/config.py index 217d8123..93b5d1e6 100644 --- a/nwg_panel/config.py +++ b/nwg_panel/config.py @@ -21,7 +21,7 @@ configs = {} editor = None selector_window = None -outputs = None +outputs = {} SKELETON_PANEL: dict = { "name": "", @@ -538,7 +538,10 @@ def edit_panel(self, *args): self.cb_output = builder.get_object("output") for key in outputs: self.cb_output.append(key, key) - if self.panel["output"] and self.panel["output"] in outputs: + + self.cb_output.append("All", "All") + + if self.panel["output"] and (self.panel["output"] in outputs or self.panel["output"] == "All"): self.cb_output.set_active_id(self.panel["output"]) screen_width, screen_height = None, None diff --git a/nwg_panel/main.py b/nwg_panel/main.py index 4edbe15d..2042631c 100644 --- a/nwg_panel/main.py +++ b/nwg_panel/main.py @@ -251,6 +251,27 @@ def main(): except Exception as e: print(e) + # Mirror bars to all outputs #48 (if panel["output"] == "All") + to_remove = [] + to_append = [] + for panel in panels: + check_key(panel, "output", "") + + clones = [] + if panel["output"] == "All" and len(common.outputs) > 1: + to_remove.append(panel) + for key in common.outputs.keys(): + clone = panel.copy() + clone["output"] = key + clones.append(clone) + + to_append = to_append + clones + + for item in to_remove: + panels.remove(item) + + panels = panels + to_append + for panel in panels: check_key(panel, "icons", "") icons_path = "" @@ -259,8 +280,6 @@ def main(): elif panel["icons"] == "dark": icons_path = os.path.join(common.config_dir, "icons_dark") - check_key(panel, "output", "") - # This is to allow width "auto" value. Actually all non-numeric values will be removed. if "width" in panel and not isinstance(panel["width"], int): panel.pop("width") @@ -380,7 +399,7 @@ def main(): check_key(panel, "layer", "top") o = panel["output"] if "output" in panel else "undefined" - print("Display: {}, position: {}, layer: {}, width: {}, height: {}".format(o, panel["position"], + print("Output: {}, position: {}, layer: {}, width: {}, height: {}".format(o, panel["position"], panel["layer"], panel["width"], panel["height"])) From a7b5f6b5cecbdd5efa7343906a5fb04080828b96 Mon Sep 17 00:00:00 2001 From: piotr Date: Tue, 13 Apr 2021 01:04:39 +0200 Subject: [PATCH 2/2] bump to 0.2.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8c9f77a7..1c871d9e 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def read(f_name): setup( name='nwg-panel', - version='0.2.1', + version='0.2.2', description='GTK3-based panel for sway window manager', packages=find_packages(), include_package_data=True,