From a0ea381c1ba114c74983902b75113ddb738f197d Mon Sep 17 00:00:00 2001 From: piotr Date: Sun, 26 Nov 2023 02:18:28 +0100 Subject: [PATCH 1/2] add switch for SUPER -> $launcher key binding --- nwg_shell_config/langs/en_US.json | 2 ++ nwg_shell_config/langs/pl_PL.json | 2 ++ nwg_shell_config/main_hyprland.py | 7 +++++++ nwg_shell_config/main_sway.py | 4 ++++ nwg_shell_config/ui_components.py | 12 +++++++++--- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/nwg_shell_config/langs/en_US.json b/nwg_shell_config/langs/en_US.json index 4dcb74b..acaa445 100644 --- a/nwg_shell_config/langs/en_US.json +++ b/nwg_shell_config/langs/en_US.json @@ -264,6 +264,8 @@ "on-layer-tooltip": "Determines the gtk-layer-shell layer to show the content on.", "open-on-overlay": "Open on overlay", "open-on-overlay-tooltip": "Open on overlay layer (over panels etc.)", + "open-on-super": "Open on SUPER key", + "open-on-super-tooltip": "Binds the SUPER key release to the program execution", "other": "Other", "output": "Output", "overlay": "On overlay", diff --git a/nwg_shell_config/langs/pl_PL.json b/nwg_shell_config/langs/pl_PL.json index 190d72f..30b50ae 100644 --- a/nwg_shell_config/langs/pl_PL.json +++ b/nwg_shell_config/langs/pl_PL.json @@ -264,6 +264,8 @@ "on-layer-tooltip": "Określa na której warstwie gtk-layer-shell wyświetlać zawartość.", "open-on-overlay": "Otwieraj w nakładce", "open-on-overlay-tooltip": "Otwieraj w warstwie nakładki (powyżej panelu itp.)", + "open-on-super": "Otwieraj po klawiszu SUPER", + "open-on-super-tooltip": "Dowiązuje zwolnienie klawisza SUPER do uruchomienia programu.", "other": "Inne", "output": "Wyjście", "overlay": "Na nakładce", diff --git a/nwg_shell_config/main_hyprland.py b/nwg_shell_config/main_hyprland.py index f10e9b7..3d4c56e 100644 --- a/nwg_shell_config/main_hyprland.py +++ b/nwg_shell_config/main_hyprland.py @@ -913,6 +913,12 @@ def save_includes(): includes.append(' mouse_move_focuses_monitor = {}'.format(bool2lower(settings["misc-mouse_move_focuses_monitor"]))) includes.append('}') + if preset["launcher-super-key"]: # add more keys when necessary, for now we have one + includes.append('\n# KEY BINDINGS') + + if preset["launcher-super-key"]: + includes.append('bindr = SUPER, SUPER_L, exec, $launcher') + p = os.path.join(config_home, "hypr/includes.conf") print("Saving includes to {}".format(p)) save_list_to_text_file(includes, p) @@ -1127,6 +1133,7 @@ def load_preset(file_name): "launcher-gtk-icon-theme": "", "launcher-force-theme": False, "launcher-run-through-compositor": False, + "launcher-super-key": False, "exit-position": "center", "exit-full": False, "exit-alignment": "middle", diff --git a/nwg_shell_config/main_sway.py b/nwg_shell_config/main_sway.py index 87e1dad..c2960ff 100644 --- a/nwg_shell_config/main_sway.py +++ b/nwg_shell_config/main_sway.py @@ -765,6 +765,9 @@ def save_includes(): lines.append(' {} {}'.format(settings["keyboard-custom-name"], settings["keyboard-custom-value"])) lines.append('}') + if preset["launcher-super-key"]: + lines.append('bindsym --release Super_L exec $launcher') + save_list_to_text_file(lines, os.path.join(config_home, "sway/keyboard")) else: save_list_to_text_file([""], os.path.join(config_home, "sway/keyboard")) @@ -976,6 +979,7 @@ def load_preset(file_name): "launcher-gtk-icon-theme": "", "launcher-force-theme": False, "launcher-run-through-compositor": False, + "launcher-super-key": False, "exit-position": "center", "exit-full": False, "exit-alignment": "middle", diff --git a/nwg_shell_config/ui_components.py b/nwg_shell_config/ui_components.py index b318bce..269fc54 100644 --- a/nwg_shell_config/ui_components.py +++ b/nwg_shell_config/ui_components.py @@ -2434,23 +2434,29 @@ def drawer_tab(preset, preset_name, voc): cb_resident.connect("toggled", set_from_checkbutton, preset, "launcher-resident") grid.attach(cb_resident, 0, 7, 2, 1) + cb_super = Gtk.CheckButton.new_with_label(voc["open-on-super"]) + cb_super.set_tooltip_text(voc["open-on-super-tooltip"]) + cb_super.set_active(preset["launcher-super-key"]) + cb_super.connect("toggled", set_from_checkbutton, preset, "launcher-super-key") + grid.attach(cb_super, 0, 8, 2, 1) + cb_overlay = Gtk.CheckButton.new_with_label(voc["open-on-overlay"]) cb_overlay.set_tooltip_text(voc["open-on-overlay-tooltip"]) cb_overlay.set_active(preset["launcher-overlay"]) cb_overlay.connect("toggled", set_from_checkbutton, preset, "launcher-overlay") - grid.attach(cb_overlay, 0, 8, 2, 1) + grid.attach(cb_overlay, 0, 9, 2, 1) cb_force_theme = Gtk.CheckButton.new_with_label(voc["run-with-gtk-theme"]) cb_force_theme.set_tooltip_text(voc["run-with-gtk-theme-tooltip"]) cb_force_theme.set_active(preset["launcher-force-theme"]) cb_force_theme.connect("toggled", set_from_checkbutton, preset, "launcher-force-theme") - grid.attach(cb_force_theme, 0, 9, 2, 1) + grid.attach(cb_force_theme, 0, 10, 2, 1) cb_run_through_compositor = Gtk.CheckButton.new_with_label(voc["run-through-compositor"]) cb_run_through_compositor.set_tooltip_text(voc["run-through-compositor-tooltip"]) cb_run_through_compositor.set_active(preset["launcher-run-through-compositor"]) cb_run_through_compositor.connect("toggled", set_from_checkbutton, preset, "launcher-run-through-compositor") - grid.attach(cb_run_through_compositor, 0, 10, 2, 1) + grid.attach(cb_run_through_compositor, 0, 11, 2, 1) frame.show_all() From 1cec4b5f606e7c805b19e4a178497305ab44cdb5 Mon Sep 17 00:00:00 2001 From: piotr Date: Sun, 26 Nov 2023 02:19:04 +0100 Subject: [PATCH 2/2] bump to 0.5.27 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 61f7cad..c6599e2 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def read(f_name): setup( name='nwg-shell-config', - version='0.5.26', + version='0.5.27', description='nwg-shell configuration utility', packages=find_packages(), include_package_data=True,