pop-os / gnome-shell

Pop!_OS fork of https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/gnome-shell
GNU General Public License v2.0
25 stars 4 forks source link

Launcher keyboard shortcut does not work with international keyboard layouts #38

Open rushills opened 4 years ago

rushills commented 4 years ago

Super+/ does not work as intended when I'm in RU layout.

ids1024 commented 4 years ago

Hm, I'm seeing the same behavior when I set an RU layout. This is kind of similar to https://github.com/pop-os/shell/issues/196, but I'm not sure if there's any binding this one would conflict with...

As a workaround, in the Keyboard Shortcuts panel of Settings, this binding is listed under Navigate Applications and Windows. You should be able to change it. But it really should work without that.

ids1024 commented 4 years ago

I think with the (somewhat questionable) way Mutter handles key bindings (which I raised an upstream issue about, though I don't know it can easily be changed), this should be triggered by super+\ on the RU layout. Since / is shift+\.

Mutter treats shift as a modifier, so it finds the keycode for the key that the keysym for / is associated. And since it is bound with the modifier super, and not with shift, it requires pressing super with that key, and no other modifiers.

But It's not working as super+\ either, so I don't know what's going on...

rushills commented 4 years ago

Yes, I have re-mapped shortcut, but it reminds me not so far past when simple "Super" did no work when pressed in many layouts except for EN.

On Fri, 2020-07-17 at 08:15 -0700, Ian Douglas Scott wrote:

I think with the (somewhat questionable) way Mutter handles key bindings (which I raised an upstream issue about, though I don't know it can easily be changed), this should be triggered by super+\ on the RU layout. Since / is shift+.

Mutter treats shift as a modifier, so it finds the keycode for the key that the keysym for / is associated. And since it is bound with the modifier super, and not with shift, it requires pressing super with that key, and no other modifiers.

But It's not working as super+\ either, so I don't know what's going on...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ids1024 commented 4 years ago

Interestingly, under the RU layout, it can be remapped to super+\, which works. It can also be remapped to super+shift+/... but even though Gnome Control Panel recognizes that, it doesn't actually end up working.

ids1024 commented 4 years ago

Such a binding seems to have similar issues with the RU layout on Fedora Rawhide, using Wayland. So it's an upstream issue (probably in Mutter), and is not related to Xorg.

ids1024 commented 4 years ago

After further investigation, it turns out it is bound. To this key:

Screenshot from 2020-07-21 18-11-52

I can't actually press that key, since my American keyboard physically doesn't have a key between Z and shift. But it can be simulated:

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/XTest.h>

int main() {
    Display *display = XOpenDisplay(NULL);

    KeyCode super_keycode = XKeysymToKeycode(display, XK_Super_L);
    // KeyCode slash_keycode = XKeysymToKeycode(display, XK_slash);
    KeyCode slash_keycode = 94; // Key on ISO keyboard between shift and Z

    XTestFakeKeyEvent(display, super_keycode, True, 0);
    XTestFakeKeyEvent(display, slash_keycode, True, 0);
    XSync(display, True);

    XTestFakeKeyEvent(display, super_keycode, False, 0);
    XTestFakeKeyEvent(display, slash_keycode, False, 0);
    XSync(display, True);
}

(Compile with gcc keypress.c -lX11 -lXtst).

Mutter only uses one key per key binding, even in the occasional case where multiple keycodes are mapped to the same keysym. There's a merge request upstream that attempts to address a similar issue, but that just changes which key it chooses, and doesn't consider the fact that some keys may physically not exist on all keyboard.

The same issue occurs on the en layout if one tries to set a binding super+<.

I must say I'm generally not impressed with how mutter handles key bindings...

rushills commented 4 years ago

I'm using international Logitech K375s and despite being made for Bulgaria (not for Russia), it has such button, please see EN layout attached. Screenshot from 2020-07-22 11-53-49

ids1024 commented 4 years ago

Right. I wasn't sure if your keyboard had that key (or if it's even standard on Russian keyboards).

Can you confirm that with this binding set it it's default, super plus that key opens the launcher? (Presumably it does, since that happens with my C code that simulates that.)

rushills commented 4 years ago

I've faced other issue. I had Pop-Shell extension disabled for some time, and when I have re-enabled it just doesn't work in EN layout too. It acts like only "/" pressed, switching to search mode in Nautilus or Settings app. Really strange but I have no time to dig deeper right now.

For experiment I may install clean install in VM later today.

rushills commented 4 years ago

I'm sorry it took longer than I anticipated. I can confirm that shortcut is working with "super"+this extra key.

ids1024 commented 4 years ago

I'm sorry it took longer than I anticipated.

No problem.

Well, at least it's clear now exactly what is happening here. Hopefully a solution can be worked out with the Mutter developers.