Bug 472444

Summary: force keyboard layout for nested kwin_wayland
Product: [Plasma] kwin Reporter: Harald Sitter <sitter>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nicolas.fella
Priority: NOR    
Version First Reported In: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Harald Sitter 2023-07-20 21:38:44 UTC
SUMMARY
In our selenium tech we use a nested kwin_wayland and send keyboard events through the fakeinput protocol. It'd be lovely if we could force the nested kwin to always use a specific XKB Rules + Model + Layouts + Variants + Options instead of using the ones from the config. Otherwise it's impossible for the outside to generate reliable keycodes for the protocol because we don't know what layout is being used nor which modifiers are set up.

STEPS TO REPRODUCE
1. systemsettings kcm_keyboard
2. go to layouts tab
3. add german (austria) as first layout
4. add english (US) as second layout 
5. kwin_wayland kwrite

OBSERVED RESULT
The nested kwin uses the austrian layout and there appears to be no way to force it to use US.


EXPECTED RESULT
Ability to force keyboard layout somehow. ENV vars might be the most in line with xkbcommon 


SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.240.0
Qt Version: 6.6.0
Kernel Version: 5.19.0-46-generic (64-bit)
Graphics Platform: offscreen
Processors: 12 × AMD Ryzen 5 3600X 6-Core Processor
Memory: 31.2 GiB of RAM
Graphics Processor: AMD Radeon RX 5700 XT

ADDITIONAL INFORMATION
Comment 1 David Edmundson 2023-07-24 13:00:08 UTC
src/xkb.cpp has a lot of env vars going on.

If you set KWIN_XKB_DEFAULT_KEYMAP to true, then it will honour:
 XKB_DEFAULT_RULES, XKB_DEFAULT_MODEL, XKB_DEFAULT_LAYOUT, XKB_DEFAULT_VARIANT, XKB_DEFAULT_OPTIONS

Let me know if that's not enough