Gnome Wayland unable to switch keyboard layout

Hello!
It’s probably a bug. I installed the latest Manjaro from manjaro-gnome-21.2.6-220416-linux515.iso image. It use Wayland by default on my hardware. Keyboard shortcuts (alt+shift by default but I tried others in gnome tweaks) to change keyboard layout don’t working.
If I change Wayland to X11 it works fine.
This issue reproduced without any tweaks on this image after installation, I tried it in virtualbox - the same story.

More details please. What layouts do you have enabled? Does the switching work in xorg?

Any keyboard layouts, not a matter (I tried different combinations), just more then 1. Yes, switching in Xorg works fine.

1 Like

Does it work when you switch it from command line? Do you get any errors?

Unfortunately I don’t know how to switch it from command line.
I investigated it and found that I was a bit wrong. Switching is working (there is a correct language when you type), but layout applet on the top right don’t react on this change and show wrong language.
Also I checked on laptop of my sister (she also use manjaro gnome with wayland session) and she have the same issue. Previously it worked, but now not.
Interesting thing that on X11 session it works as expected.

1 Like

Okay, seems like a bug in gnome shell then. Likely solution is to wait for an update and hope it is getting fixed. But if the layout switching actually works, I imagine this is more of an annoyance than a serious issue?

Looks like yes :slight_smile:
I just wanted to report it somewhere because it’s some basic functionality that really should work to make a good first impression. I also checked it in manjaro unstable branch with gnome 42 - the same problem.

2 Likes

you can fix this… by deleting the Xorg config files in /etc/X11/xorg.conf.d/

delete the content and reboot.

after the reboot the system will create new conf files and the layout should be fixed…

Unfortunately it will not help. As I mentioned above it happens on wayland session only. Xorg session is fine.

did you test it? i also had the problem in wayland only

Yes, I tried… There was one config (keyboard-***.conf). After removing and rebooting nothing was changed.

In X11, any shortcuts and switching layouts are done by XKB. In GNOME (both in the X11 session and in Wayland), XKB only switches layouts with modifier keys (Caps, Shift, Ctrl, Alt, etc), and switching with ordinary shortcuts (Super+Space, for example) is done using libmutter. For some reason, XKB counts the shortcuts when you press the keys, and not when you release them. This breaks many shortcuts in other applications where the same keys are used as for switching layouts. This bug has been known for 18 years.

In the Wayland GNOME session, combinations of several modifier keys that are controlled via XKB are broken. The layout switches, but there is no visual indication. The problem is not considered important. The developers had plans to add these combinations to the usual settings (which means they will be controlled via libmutter), but it is unknown when they will do it.

As a solution, you can use a Mod+Space and additionally install the “Quick Lang Switch” extension.

And also try pressing Alt first and only then pressing Shift. In this case, my layout was switched, however, this is completely inconvenient

2 Likes

Thank you for the explanation!
I hope they will fix it :slight_smile: And I think this is a really important problem. It will confuse any newcomer that it’s not possible to switch keyboard layout by his habitual combination.

Try this one:

gsettings set org.gnome.desktop.wm.keybindings switch-input-source “[‘<Shift>Alt_L’]”
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward “[‘<Alt>Shift_L’]”