graesslin created this revision. graesslin added reviewers: KWin, Plasma on Wayland. Restricted Application added subscribers: kwin, plasma-devel. Restricted Application added projects: Plasma on Wayland, KWin.
REVISION SUMMARY On X11 the SNI for keyboard layout is provided by the keyboard kded. On Wayland that kded has no real access to the layouts and cannot properly implement switching. Given that it's better to integrate the SNI directly in KWin. The implementation of the SNI is largly based on the existing SNI from plasma-desktop/kcms/keyboard. The implementation so far supports: - Switching to next layout on toggle - Presenting all layouts in a context menu - Switching to a specific layout through the context menu - Opening the keyboard layout configuration module Not yet supported are: - config option whether to show the SNI - scroll on SNI - flags and/or short text for the layouts The last point needs more explanation. On X11 the layout name is something like "de" or "us". This can be directly mapped to a flag and can be added as a short note. Xkbcommon does not provide this information directly. Instead it provides us the full name of the layout, e.g. "German" or "English (us)". There is no way in the API to go from "German" to "de". Instead we need to parse the evdev.xml file to gather all information about layouts. This is already done in the keyboard kcm to configure layouts. The implementation needs to be split out into a small helper library. REPOSITORY R108 KWin BRANCH keyboard-layout-sni REVISION DETAIL https://phabricator.kde.org/D4220 AFFECTED FILES keyboard_input.cpp keyboard_input.h keyboard_layout.cpp keyboard_layout.h EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: graesslin, #kwin, #plasma_on_wayland Cc: plasma-devel, kwin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, eliasp, sebas