diff --git a/guake/keybindings.py b/guake/keybindings.py index b2c1153d2..fda357588 100644 --- a/guake/keybindings.py +++ b/guake/keybindings.py @@ -23,9 +23,7 @@ import gi gi.require_version("Gtk", "3.0") -gi.require_version("Gdk", "3.0") from gi.repository import Gtk -from gi.repository import Gdk from guake import notifier from guake.common import pixmapfile @@ -230,18 +228,8 @@ def reload_global(self, settings, key, user_data): def activate(self, window, event): """If keystroke matches a key binding, activate keybinding. Otherwise, allow keystroke to pass through.""" - key = event.keyval + key = event.hardware_keycode mod = event.state - if mod & Gdk.ModifierType.SHIFT_MASK: - if key == Gdk.KEY_ISO_Left_Tab: - key = Gdk.KEY_Tab - else: - key = Gdk.keyval_to_lower(key) - else: - keys = Gdk.keyval_convert_case(key) - if key != keys[1]: - key = keys[0] - mod &= ~Gdk.ModifierType.SHIFT_MASK mask = mod & self._masks @@ -266,11 +254,10 @@ def load_accelerators(self): """Reads all gconf paths under /apps/guake/keybindings/local and adds to the _lookup. """ - for binding, action in self.keys: - key, mask = Gtk.accelerator_parse( + key, keycodes, mask = Gtk.accelerator_parse_with_keycode( self.guake.settings.keybindingsLocal.get_string(binding) ) - if key > 0: - self._lookup[mask][key] = action + if keycodes and keycodes[0]: + self._lookup[mask][keycodes[0]] = action self._masks |= mask diff --git a/releasenotes/notes/use_keycode_for_keybindings-a4fb151a046a28c9.yaml b/releasenotes/notes/use_keycode_for_keybindings-a4fb151a046a28c9.yaml new file mode 100644 index 000000000..050b99d48 --- /dev/null +++ b/releasenotes/notes/use_keycode_for_keybindings-a4fb151a046a28c9.yaml @@ -0,0 +1,5 @@ +release_summary: > + Use keycodes instead of keyvals for keybindings. This allow to use keybindings with different keyboard layouts. + +known_issues: + - keybindings does not work with not English layout. #1946