@@ -102,6 +102,8 @@ Item {
102 // internal props from here onwards
102 // internal props from here onwards
103 readonly property var mainApp:
103 readonly property var mainApp:
104 applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainApp : null
104 applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainApp : null
105+ readonly property var mainAppWindow:
106+ applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainAppWindow : null
106 // Disable everything while greeter is waiting, so that the user can't swipe
108 // Disable everything while greeter is waiting, so that the user can't swipe
107 // the greeter or launcher until we know whether the session is locked.
109 // the greeter or launcher until we know whether the session is locked.
@@ -737,6 +739,57 @@ Item {
737 onMouseMoved: { cursor.opacity = 1; }
739 onMouseMoved: { cursor.opacity = 1; }
744+ shortcut: Qt.MetaModifier|Qt.Key_Space
745+ onTriggered: keymapPriv.nextKeymap()
746+ active: keymapPriv.keymapCount > 1
750+ shortcut: Qt.MetaModifier|Qt.ShiftModifier|Qt.Key_Space
751+ onTriggered: keymapPriv.previousKeymap()
752+ active: keymapPriv.keymapCount > 1
758+ readonly property var keymaps: AccountsService.keymaps
759+ readonly property int keymapCount: keymaps.length
760+ readonly property int activeKeymapIndex: mainAppWindow ? keymaps.indexOf(mainAppWindow.activeKeymap) : 0 // the one that the window currently has
761+ property int currentKeymapIndex: 0 // the new one that we're setting
762+ onCurrentKeymapIndexChanged: switchToKeymap();
764+ function nextKeymap() {
767+ if (activeKeymapIndex !== -1 && activeKeymapIndex < keymapCount - 1) {
768+ nextIndex = activeKeymapIndex + 1;
770+ print("!!! next keymap:", currentKeymapIndex, "->", nextIndex);
771+ currentKeymapIndex = nextIndex;
774+ function previousKeymap() {
775+ var prevIndex = keymapCount - 1;
777+ if (activeKeymapIndex > 0) {
778+ prevIndex = activeKeymapIndex - 1;
780+ print("!!! prev keymap:", currentKeymapIndex, "->", prevIndex);
781+ currentKeymapIndex = prevIndex;
784+ function switchToKeymap() {
785+ if (mainAppWindow) {
786+ mainAppWindow.switchToKeymap(keymaps[currentKeymapIndex]);
791+ onMainAppWindowChanged: keymapPriv.switchToKeymap()
740 Rectangle {
793 Rectangle {
741 id: shutdownFadeOutRectangle
794 id: shutdownFadeOutRectangle
742 z: cursor.z + 1
795 z: cursor.z + 1