@@ -37,7 +37,8 @@ Item {
3737
3838 readonly property var keymaps: AccountsService.keymaps
3939 readonly property int keymapCount: keymaps.length
40− property int currentKeymapIndex: 0
40+ // default keymap, either the one remembered by the indicator, or the 1st one selected by user
41+ property int currentKeymapIndex: actionGroup.currentAction.valid ? actionGroup.currentAction.state : 0
4142 readonly property string currentKeymap: keymaps[currentKeymapIndex]
4243
4344 function nextKeymap() {
@@ -72,6 +73,10 @@ Item {
7273 objectPath: "/com/canonical/indicator/keyboard"
7374
7475 property variant currentAction: action("current")
76+ property variant activeAction: action("active")
77+
78+
79+ Component.onCompleted: actionGroup.start();
7580 }
7681
7782 onCurrentKeymapIndexChanged: {
@@ -79,11 +84,12 @@ Item {
7984 actionGroup.currentAction.updateState(currentKeymapIndex);
8085 }
8186
87+ readonly property int activeActionState: actionGroup.activeAction.valid ? actionGroup.activeAction.state : -1
8288
83− Component.onCompleted: {
84− actionGroup.start();
85− if (actionGroup.currentAction.valid) {
86− // TODO root.currentKeymapIndex = actionGroup.activeAction.state; // restore keymap saved by the indicator
89+ onActiveActionStateChanged: {
90+ print("!!! Active keymap changed (via indicator) to:", activeActionState);
91+ if (activeActionState != -1) {
92+ currentKeymapIndex = activeActionState;
8793 }
8894 }
8995}