Support global shortcut to switch to specific layout

Authored by graesslin on Jan 23 2017, 7:10 PM.



Our keyboard layout kcm allows to set a global shortcut to switch to a
specific keyboard layout. So far KWin/Wayland did not support those
shortcuts, only the switch to next layout shortcut was supported.

This change introduces support for custom layout shortcuts. For that
we iterate over all available layouts and check whether a shortcut is
registered. If that is the case a QAction is created and passed to

As the triggering code is similar to the menu, the switchLayout lambda
is split out into a dedicated method and translating the layouts is
extracted into a method.

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 10466.Jan 23 2017, 7:10 PM
graesslin retitled this revision from to Support global shortcut to switch to specific layout.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added reviewers: KWin, Plasma on Wayland.
Restricted Application added projects: Plasma on Wayland, KWin. · View Herald TranscriptJan 23 2017, 7:10 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
sebas accepted this revision.Jan 26 2017, 12:58 PM
sebas added a reviewer: sebas.
This revision is now accepted and ready to land.Jan 26 2017, 12:58 PM
This revision was automatically updated to reflect the committed changes.