Bug 484044

Summary: add support for win32-input-mode
Product: [Applications] konsole Reporter: Ivan Sorokin <ivan.sorokin.tech>
Component: keyboardAssignee: Konsole Bugs <konsole-bugs-null>
Status: REPORTED ---    
Severity: wishlist CC: christoph
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ivan Sorokin 2024-03-20 09:15:39 UTC
[fixterms and kitty's enhanced keyboard protocol](https://bugs.kde.org/show_bug.cgi?id=435975) are not the only existing enhanced keyboard protocols supported by terminals. There also exist the other one, called win32-input-mode.

Protocol spec:
https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md

Reference implementation on the terminal side:
https://github.com/wez/wezterm/issues/1509

Reference implementation on the console app side:
https://github.com/elfmz/far2l/pull/1581

Reference implementation on the TUI framework side:
https://github.com/magiblot/tvision/commit/5c017a81ef82876a27532a5676e653f035346b49

[This small lib](https://github.com/unxed/xkb2win/) should help with translating X11 key codes to win32-input-mode ones.
Comment 1 Ivan Sorokin 2025-10-04 12:29:12 UTC
Implemented in
https://invent.kde.org/utilities/konsole/-/merge_requests/1133
Comment 2 Ivan Sorokin 2025-11-25 07:53:30 UTC
Ping please :)
Comment 3 Ivan Sorokin 2026-02-10 11:59:35 UTC
Now that the Linux implementation for win32-input-mode based on xkbcommon has been merged, it is worth considering support for Windows and macOS. Unfortunately, I do not have access to these operating systems to implement or test this myself, but the task should be relatively straightforward for someone with access to these environments.

For the implementation, the current #ifdef HAVE_XKBCOMMON block needs to be expanded with platform-specific checks. On Windows, the task is actually trivial because QKeyEvent::nativeVirtualKey() and nativeScanCode() already return exactly what the protocol requires, so we just need to pass those values through directly without using xkb. On macOS, QKeyEvent provides native Apple keycodes, so we would need to write a switch-case helper function to map those Mac specific codes to the Windows Virtual Key constants that are already defined in WinKeys.h.