Skip to content

Commit

Permalink
Merge pull request #65 from nwg-piotr/bindings
Browse files Browse the repository at this point in the history
Profile -> Application drawer: add a check button to bind the SUPER key release to the $launcher command
  • Loading branch information
nwg-piotr authored Nov 26, 2023
2 parents be8dda3 + 1cec4b5 commit bf1370f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions nwg_shell_config/langs/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions nwg_shell_config/langs/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions nwg_shell_config/main_hyprland.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions nwg_shell_config/main_sway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 9 additions & 3 deletions nwg_shell_config/ui_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bf1370f

Please sign in to comment.