Keyboard layout in Wayland doesn't work correctly

Hello mates,

I’m on a fresh Fedora KDE 36 install and I have an international english keyboard but I like to type in brazilian portuguese sometimes, so I always set two keyboard layouts so that I can switch when needed, US international and brazilian ABNT2.

ABNT2

I tried setting the different keyboard layout in Plasma Settings but the only key that was being recognized was Ç.
I searched on the internet and I saw a command that could fix it:

setxkbmap -model abnt2 -layout br -variant abnt2

And it did work, but it didn’t persist across reboot, so I searched on the Fedora’s docs and the right command was:

localectl set-keymap br-abnt2

But that didn’t work either, locale.conf seems to be right, as well as vconsole.conf, but the only key working from the ABNT2 layout was still Ç and it made it worse since now the first command also doesn’t work anymore.

However I found out that the keyboard layout is working on X11 Plasma and it’s working on another TTY console, the problem is restricted only to Wayland.
I’m typing in brazilian portuguese on X11:

Acentuação; Olá, Olé, Bebê, Robô, Córtex, Poções, Lingüiça (antigo), Às três

Is there another command to change the layout or is it a Wayland bug and I should report it.

2 Likes

While I do not have your config the description, and the fact that things work properly under xorg but not wayland seems to indicate it is wayland related.

I would suggest at least filing the bug under wayland and let the developers sort it out.

Have a look at 2076596 – The KDE ibus panel is not able to switch keyboard layouts on Wayland

And see if it’s the same issue.

Thanks.

1 Like

Hi,

I have the same issue since an installation by updates of Gnome 4.1 on my system. Locale is set correctly to language EN, using FR keyboard (azerty). All input past the logon screen is in qwerty. Changing the options in gnome settings do not “stick” on screen but seem to be applied. However the problem is always the same past logon screen, the keyboard is always in qwerty (en).
I am running Nvidia on X11 and not on wayland …

loginctl show-session (sessionid) -p Type
Type=x11

Device-1 NVIDIA GK104 [GeForce GTX 760]
vendor Micro-Star MSI
driver nvidia 12v 470.103.01
bus-ID 01:00.0
Display x11 server X.Org v 1.20.14 driver X
loaded nvidia
unloaded fbdev,modesetting,nouveau,vesa gpu nvidia,nvidia-nvswitch
resolution 1920x1080~60Hz
OpenGL renderer NVIDIA GeForce GTX 760/PCIe/SSE2 v 4.6.0 NVIDIA 470.103.01
direct render Yes

System Locale: LANG=en_GB.UTF-8
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
VC Keymap: fr-azerty
X11 Layout: fr
X11 Variant: azerty

Best regards,
Patrick.

When I boot the system I have the same problem.
I have an invisible icon in the system tray called IBus, if I close it my layout English (intl., with AltGr dead keys) starts to work well again!

So probably @joe is right, and 2076596 – The KDE ibus panel is not able to switch keyboard layouts on Wayland is the issue for me!

1 Like

Hello again mates, the bug is indeed that IBUS panel one as @grumpey and @cirelli94 pointed out, closing ibus panel fixes the issue on firefox.

I was not sure what ibus was even used for so I just uninstalled it (and everything that required it) to see what it would break and firefox worked as intended in portuguese but XWayland applications like ferdi didn’t produced decomposed characters (combined characters with accents) like intended, so perhaps that is the issue here.

I guess ibus is needed so that XWayland windows produce these decomposed characters but it’s blocking the keys used to produce them on Wayland windows.

The images bellow explains what decomposed characters are, which are activated by some ISO Level1 and Level2 keys, marked in red on the keyboard layout for brazilian portuguese, while ISO Level3 and Level 4 green ones don’t produce decomposed characters and were working as intended.

cmletters

Also, after uninstalling and reinstalling ibus, it looks like the bug went away if I close ibus and run the , it’s working as intended without needing to close the Ibus Panel, perhaps there’s some configuration file left behind during development that was messing with it’s function, it was erased while uninstalling and now it’s all fine.

I set Ibus Panel to use the system’s layout and everything works now.

EDIT: you still need to close Ibus panel and start ibus-daemon from terminal so that it works, but it’s better than before.

acentuação, olá, olé, bebê, robô, córtex… all in wayland and also in xwayland.

Hi Cirelli94,
I’m running X11 and ibus-daemon and I find that although my localectl is ok, the only setting helping me get the keyboard ok is the command:

setxkbmap -model PC105 -layout fr -variant azerty

In ibus-panel or gnome settings, there is no keyboard data displayed in input sources (no English; no French). Like higher up in the post locale.conf and vconsole.conf are ok. I don’t see any icon for keyboard setting on my system tray either. As I don’t use KDE, already have the ibus-daemon running, don’t use wayland, I think the problem is still around ibus but not limited to wayland. Any ideas ? Thanks. Patrick.

:grimacing: I’m sorry I don’t have any other ideas!

If you try to pkill ibus-daemon?

Hi @cirelli94,
I did try and that did not work either.
It seems my system is somewhat flawed (the whole of Gnome is buggy).
no backgrounds possible, system tray not working, … etc.
I need to restart at basics and build up again.
Thanks for the help.

Hello mates,

@dacanizares suggested a command on the bugtracker that seems to do the trick without the need to kill the ibus-panel and it works on wayland and xwayland.

ibus engine xkb:us:intl:eng

In my case, in order to change to brazilian portuguese:

ibus engine xkb:br:nativo:por

You can find the right engine for any language with the command bellow:

ibus list-engine | grep Your-Language

It works for me!
Does it work permanently after each boot?

Sort of.

I use english international on a regular basis, it’s my default keyboard, I change the keyboard layout with a shortcut to use portuguese when needed. If I use this command, use the portuguese layout and reboot, english will be the running layout and if I change to portuguese, it will work as expected.

So, it persists across reboots, however, if I change back to english and then change again to portuguese then it doesn’t work anymore unless I run that command.

So, it’s permanent until you change the layout to anything that’s not the language that you set on the command, I guess changing the layout to english undo whatever that command does.

EDIT: this seems to be related to some programs running on Wayland. If I just reboot and change to portuguese, back to english and then back to portuguese, it works fine. However, If I do that while firefox is opened then it stops working.

It’s not a stable solution.

I’ve been struggling with this problem for over a year now. I also have a US keyboard on a Think Pad and I want to be able to write in Brazilian Portuguese with it.

I made some progress following these instructions:

After installing gnome-tweaks and enabling “show extended input sources” I was able to fix the issue: when adding a new input source, after selecting the language (English (US)) another menu appears selecting the variant (which I’ve chosen us-intl for my case).

Now I’m able to do things like: á ã à â but I’m not able to write cedilla (Ç). When using English keyboards we are supposed to create cedilla typing ´ followed by the letter C. But with the configuration I have, this is what I’m getting Ć, a C with an accent.

Was anyone able to solve this problem?

Hello mates,

ibus and components got an update on last friday and it seems to be working now on Plasma without any command or closing the ibus-panel, persistent across reboots and layout changes.

The description of the problem can be found at the package page and following this bug tracker. Maybe the one listed on this thread is a duplicate? Maybe a different bug, idk.
https://koji.fedoraproject.org/koji/buildinfo?buildID=1975805

https://bugzilla.redhat.com/show_bug.cgi?id=2088656

Why don’t you just use the portuguese brazilian native layout alongside the english international and just change it when needed?

See this page:
https://help.gnome.org/users/gnome-help/stable/keyboard-layouts.html.en

I just tested this on a Fedora 36 (gnome) VM, clicked on activities, settings, keyboard, plus sign to add portuguese Brazil, and the first layout above, it just says Portuguese Brazil but it’s the native ABNT2.

Then when you want to switch just press Super (WinKey) + Space. I tested and it seems to be working fine.

Hi, @thunderbirdtr , thanks for the reply. That’s not what I want. That config is for Brazilian keyboard layout and if I set up my OS like that, my keyboard is gonna be a mess.
Semi-collon key will turn in to cedilla, question mark will become collon, and so on.

For example, on Windows if you choose:

Language: Brazilian Portuguese
Keyboard Layout: US International

I’m able to use all the accents and pressing ´+ c will result in cedilla. I’m pretty sure I was able to do that with Fedora in the past.

I do agree with @pastelicon2 that now with Plasma it’s working right, with the last update.

OK, now I get it, my bad, you want to mimic Windows behavior, I just use ABTN2 on top of us intl and got used to it although it’s indeed ugly, didn’t even remembered it was like that.

I was going to suggest opening a specific topic about it but maybe going straight to devs might be a better option, this seems very specific, I’m a hobbyist at most, maybe the users mailist connected to devs might be a better option.

users@lists.fedoraproject.org

I’ve just visited a Fedora 36.1.5 distro at a PC with European Portuguese keyboard and it does not type right: the layout is this