The Alt+Shift issue
Making a place for discussion and brainstorming about what to do about the Alt+Shift issue, which is some what complicated, and might impact a lot of users.
Background
The problem
Alt+shift doesn't work as a shortcut (with the default keymap). Many users like to use this for layout switching, it appears.
Why?
By default, xkeyboard-config
maps shifted alt to meta, so kglobalacceld
gets meta
events instead of alt
events. (On x11, xev also reports meta keyPress when alt is pressed with shift held down).
Our shortcut handling depends on Qt keycodes, which are converted from x11 keysyms.
Possible Solutions
Push for an upstream change in xkeyboard-config and tell distros to apply that patch.
Remove that default mapping for shifted alt to meta.
See https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/488 for upstream discussion.
Pros
No code changes needed on our part.
Cons
It will probably be very hard to change something that has been around for more than twenty years.. (e.g., see https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/9bbda6bfbcc29a575ea3b5cb7bd2553767e80d53/symbols/pc#L216). Maybe it is needed in some weird use case?
For modifier-keys used in shortcuts, use the unshifted keysyms
Pros
Immediately fixes the problem, requiring only changes on our end.
Cons
Needs to add special case handling code to kglobalacceld and maybe kwin, some what increasing code complexity.
For all shortcuts, use the unshifted keysyms
Store and trigger all shortcuts including shift as shift+unshifted key sym, instead of shifted key sym. E.g., Meta+! will be stored and triggered as Meta+Shift+1.
Pros
Makes user-defined shortcuts involving shift displayed in a friendlier manner (BUG: 434988)
Cons
Unclear how such shortcuts should work across different layouts. E.g., if a default shortcut is set to Ctrl++
, what should we do when +
is a shifted symbol in the layout? In some layouts +
is a shifted symbol, and in some layouts it is not.
Implement support for shortcuts using native keycodes
Native keycodes are generated by the OS and are independent of the keymap. They are exposed as QKeyEvent->nativeScanCode()
.
Pros
- Would make shortcuts more consistent for users who switch layouts (e.g., BUG: 453661)
- Add ability to differentiate between left/right modifiers
- Fixes BUG: 422401
Cons
- Requires changes in
frameworks/kglobalaccel
, and many of its callers - Requires designing new UI
- Probably not doable by 6.2, maybe 6.3 is feasible.
Pros
Immediately fixes the problem, requiring only changes on our end.
See also
- https://gitlab.freedesktop.org/xorg/xserver/-/issues/258
- https://bugs.kde.org/show_bug.cgi?id=491644
- kwin#228 (closed)
cc @odeda @vvova @zhumarin @teams/usability @ilyabizyaev and kwin folks @vladz @zamundaaa