You are not logged in.

#1 2024-04-07 09:03:59

Termy
Member
Registered: 2019-11-06
Posts: 43

[SOLVED] Keyboard layout for XWayland apps not (always) applied

Hi, i’m not sure if that’s a KDE or xwayland issue, and i’m kinda stumped i don’t really find much about it…

I switched to wayland with the update to plasma6 but now have the issue that xwayland doesn’t seem to pick up the keyboard layout (us altgr-intl) most of the time.

Sometimes it works after boot, sometimes it works after switching back and forth between layouts, sometimes that doesn’t help. Sometime it even works after boot but at some point stops working and is back to default us layout (i guess) and i have no idea when/why that happens…

It seems that all xwayland apps are either affected or not affected together at a specific time, so at least there is some consistency ^^

Has anyone experienced something similar or has some hint to point me in the right direction?

Solution: see #6 - my .zshrc was messing up calling setxkbmap...

Last edited by Termy (2024-04-15 18:37:02)

Offline

#2 2024-04-07 10:13:02

seth
Member
Registered: 2012-09-03
Posts: 51,655

Re: [SOLVED] Keyboard layout for XWayland apps not (always) applied

Try to use https://wiki.archlinux.org/title/Xorg/K … tion_files instead of relying on the transient plasma config.

Offline

#3 2024-04-07 16:11:35

Wild Penguin
Member
Registered: 2015-03-19
Posts: 321

Re: [SOLVED] Keyboard layout for XWayland apps not (always) applied

Hi,

I believe this is a bug in Plasma. Another wild guess: this may have something to do with chosen display manager. I'm using sddm currently. It used to be way worse with keyboard in KDE Plasma under Wayland (the number pad shortcuts have been fixed).

See my thread here: https://bbs.archlinux.org/viewtopic.php?id=293506 . The topic is misleading, I've since posting noticed that it seems that randomly all applications (not just Electron!) get their KB layout reverted to US English (or whatever, I have no idea how to check the actual layout).

It seems as if the feature to "remember keyboard layout for each application" -feature get's half-enabled, despite 1) being disabled and 2) only one keyboard layout set up in KDE Plasma settings; i.e. some applications have my desired layout while some do not (but instead choose some variant of Enlish I have not set anywhere; even my system default is Finnish).

I've noticed if you go to the keyboard settings in KDE Plasma and uncheck or check the checkbox for "choose layouts" (depending on whatever the checkbox used to be) the keyboard works correctly again on all open windows, until you open some application and it just decides to revert to some English again, but just for newly opened applications. This is the only workaround I've noticed, I need to constantly go to the settings and (un)check this checkbox.

Possible upstream bug reports or related bug reports:

https://bugs.kde.org/show_bug.cgi?id=417345 and
https://bugs.kde.org/show_bug.cgi?id=427589

I've since reverted back to running Plasma on X.Org, since at least with X.Org everything works without issues like these (another one being konsole windows don't open up automatically / sessions saving is non-functional or broken) which interrupt my workflow constantly. I haven't had time to investigate recently since I actually need to get some work done.

Please let us know if you find anything or if seth's suggestion works!

EDIT:
I've had in /etc/X11/xorg.conf.d/00-keyboard.conf:

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "fi"
EndSection

since as far as I can remember (the file is dated 1.12.2022).

Cheers!

Last edited by Wild Penguin (2024-04-07 16:36:48)

Offline

#4 2024-04-08 08:13:37

seth
Member
Registered: 2012-09-03
Posts: 51,655

Re: [SOLVED] Keyboard layout for XWayland apps not (always) applied

it seems that randomly all applications (not just Electron!) get their KB layout reverted to US English

https://bugs.archlinux.org/task/77789 ?
Can you trigger the issue by re-plugging the keyboard (assuming it's an external device)?

=> Try to add

sudo touch /etc/systemd/do-not-udevadm-trigger-on-update

Offline

#5 2024-04-12 17:02:14

Termy
Member
Registered: 2019-11-06
Posts: 43

Re: [SOLVED] Keyboard layout for XWayland apps not (always) applied

Sorry for the late reply - bricked my mainboard with an (successful) UEFI-Update right after modifying /etc/X11/xorg.conf.d/00-keyboard.conf. I haven't had much hope though because that was still set to the german layout i used a while ago. And indeed, that didn't change the problem.

The linked bugreports don't seem to be relevant to this as i only have this issue with xwayland. And as far as i could tell till now it either affects ALL xwayland apps or it works on ALL xwayland apps.
Re-Pluggin the keyboard doesn't seem to trigger the issue.

I might have to check if it works with having a different language layout, to figure out if maybe only the variant is "reset" sometimes...the fact that i haven't found a reliable way to trigger the issue makes that kind of difficult/annoying though ^^

Offline

#6 2024-04-14 08:21:49

Termy
Member
Registered: 2019-11-06
Posts: 43

Re: [SOLVED] Keyboard layout for XWayland apps not (always) applied

So, i still can't trigger it reliably, but it indeed also happens with other languages. It seems it doesn't just revert the variant like i thought, but indeed reverts to default en_US keymap.
Also by now i'm fairly certain that changing something in the keyboard layouts in the system settings seem to (at least fairly) reliably correct the isse. At least far more reliably than changing the layout via the system tray.

Xorg.0.log shows the correct layout after boot (steam as xwayland client is in autostart):

[   602.173] (II) XINPUT: Adding extended input device "Keychron Keychron Q10 Consumer Control" (type: KEYBOARD, id 22)
[   602.173] (**) Option "xkb_layout" "us"
[   602.173] (**) Option "xkb_variant" "altgr-intl"

But doesn't log anything when the layout reverts to plain us.

I'm noticing this in the journal that could coincide with the reverting of the layout:

kwin_wayland_wrapper[15969]: The XKEYBOARD keymap compiler (xkbcomp) reports:
kwin_wayland_wrapper[15969]: > Warning:          Unsupported maximum keycode 708, clipping.
kwin_wayland_wrapper[15969]: >                   X11 cannot support keycodes above 255.
kwin_wayland_wrapper[15969]: > Warning:          Could not resolve keysym XF86KbdInputAssistPrevgrou
win_wayland_wrapper[15969]: > Warning:          Could not resolve keysym XF86KbdInputAssistNextgrou

I'll have to investigate that maximum keycode thing, maybe that is the trigger...

Edit: yep, i think that was the right track.
I still had some setxkbmap in my zshrc and the thing triggering the change apparently was starting a new shell session.
Finally cleaned up the zshrc and it seems to not occur anymore. At least after short testing, hopefully that will stay that way. ^^
Will observe for a day before marking as solved.

Last edited by Termy (2024-04-14 08:49:23)

Offline

Board footer

Powered by FluxBB