Skip to content

Keybindings does not work with not English layout. #1946

Description

@vantu5z

Keybinds with layout sensitive keys (letters and other) doesn't work.
Test on Arch Linux.

In Guake 3.7.0 keybindings works on both layouts, I think because there used Gtk.AccelGroup.
This was changed in commit 6af0a95 and now keyval is used.
Maybe we should back to Accel realisation with build-in magic.

For example copy keys (Ctrl+Shift+C)
For US layout

keyval:  67
mod:  <flags GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD2_MASK of type Gdk.ModifierType>
scancode/keycode:  54

For RU layout

keyval:  1779
mod:  <flags GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD2_MASK | GDK_MODIFIER_RESERVED_13_MASK of type Gdk.ModifierType>
scancode/keycode:  54

As workaround convert keycode to english keyval, for me it look like this:

keybindings.py

def activate(self, window, event):
        key = event.keyval
        mod = event.state
        keycode = event.get_keycode()
        if keycode[0]:
            ent = Gdk.Keymap.get_for_display(window.get_display()).get_entries_for_keycode(keycode[1])
            if ent[0]:
                key = ent[2][0]
        ...

This code does not full tested so it can crash in some case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions