Bug 503632

Summary: Wayland : settings app keyboard layouts don't apply to X11 applications
Product: [Plasma] kwin Reporter: Xavier Lukhas <Xavier.Lukhas>
Component: xwaylandAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: minor CC: butirsky, dec05eba, dev, duha.bugs, natalie_clarius, nate, xaver.hugl
Priority: NOR    
Version First Reported In: 6.3.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screenshot of gsr-ui shortcut settings

Description Xavier Lukhas 2025-05-01 20:20:24 UTC
Created attachment 180861 [details]
Screenshot of gsr-ui shortcut settings

SUMMARY

TL; DR: I'm using Arch Linux on Wayland installed with the archinstall script, in which I've set the keyboard layout and locale  to French. I wanted to have multiple keyboard layouts, at least QWERTY in addition to my AZERTY layout, but it messes up shortcuts set in X11 applications. Namely gpu-screen-recorder when I empty certain shortcuts fields I don't want to use (as I prefer to use Spectacle shortcuts for screenshots). If I remove all layouts, it works as expected.

I'll put a few quotes here about a back-and-forth I've had with the developer of gpu-screen-recorder (https://git.dec05eba.com/gpu-screen-recorder-ui/about/).

Me:
" I wanted to report an issue I found with the ui app. When I remove the shortcut for taking screenshots (backspace when configuring the shortcut), my numpad's * (multiplication) key is captured by the app and takes screenshots instead. I've opted to put a bogus shortcut instead that's impossible to type with one hand to circumvent the issue."

"Hello,
I managed to figure out what setting was causing the issue. I had alternate key maps set up in KDE's keyboard configuration in order to switch between my regular French layout and a QWERTY US layout. Having any layout set up there and enabled at all does result in gsr creating screenshots instead of getting the * key. If remove the layouts, or disable alternative layouts, it works as expected.It might be something really specific with my system though since I had used archinstall to quickly reinstall my system way back when, and I had asked the script to configure the default layout. Maybe there's a conflict with KDE's keyboard settings and my system's innate keyboard layout configuration."

dec05eba:
"I'm unable to reproduce that issue when doing exactly that. But I did not that the hotkeys are incorrect when doing that, it applies qwerty layout hotkeys even when in french layout.I needed to run "setxkbmap fr" to make french apply to gpu screen recorder as well.I think this might actually be a kde plasma wayland bug, it doesn't apply keyboard layout change properly to x11 applications.

STEPS TO REPRODUCE
1. Install gpu-screen-recorder and gsr-ui;
2. Add a keyboard layout (any will do);
3. In gsr-ui, as shown in the picture, empty the screenshot shortcut options.

OBSERVED RESULT
The numpad "*" key takes screenshots through gpu-screen-recorder

EXPECTED RESULT
Getting the "*" when I type on it.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux x64 Wayland
KDE Plasma Version: plasma-desktop 6.3.4-1
KDE Frameworks Version: frameworkintegration 6.13.0-1 (kf6)
Qt Version: qt6-base 6.9.0-1 (qt6)

ADDITIONAL INFORMATION
I've discussed back and forth with the developer of the app to see if he could reproduce it. He couldn't reproduce it exactly, but has observed a similar behaviour.
Comment 1 dec05eba 2025-05-01 20:38:57 UTC
This specifically happens because gpu screen recorder ui grabs the keyboard device (/dev/input device) and creates a virtual keyboard (with /dev/uinput). In those cases setxkbmap needs to run to update keyboard mapping for x11 applications. This can be easiest be observed when running keyboard remapping software, switching to french keyboard layout in kde settings and then running xev. It will keep qwerty layout using setxkbmap is run.
Comment 2 Wismill 2025-05-02 16:03:19 UTC
1. Do you observe the same issue with other X11 applications in a Wayland session?
2. Do you observe the same issue using gpu-screen-recorder in a X11 session?
3. Is the issue specific to the * numpad key?

Note that setxkbmap should not be used in a Wayland session. Indeed it should display the warning “WARNING: Running setxkbmap against an Xwayland server”.
Comment 3 Zamundaaa 2025-05-02 16:22:22 UTC
Switching between keyboard layouts works as expected with normal X11 apps running through Xwayland.

Please use the global shortcuts portal to do shortcuts properly. We can't support workarounds like that.
Comment 4 Xavier Lukhas 2025-05-02 18:57:44 UTC
(In reply to Wismill from comment #2)
> 1. Do you observe the same issue with other X11 applications in a Wayland
> session?
I don't think so. I tried with VLC and Discord, which I believe run under XWayland (I used xeyes to check).
> 2. Do you observe the same issue using gpu-screen-recorder in a X11 session?
I do actually. Funny, I hadn't thought to check.
> 3. Is the issue specific to the * numpad key?
On my setup with my keyboard (Logitech G815), it is specific to that key. It goes away if I stop the service. `systemctl --user stop gpu-screen-recorder-ui.service`
> Note that setxkbmap should not be used in a Wayland session. Indeed it
> should display the warning “WARNING: Running setxkbmap against an Xwayland
> server”.