@@ -16,6 +16,7 @@
1616
1717import QtQuick 2.4
1818import AccountsService 0.1
19+import GSettings 1.0
1920import GlobalShortcut 1.0
2021import QMenuModel 0.1
2122import Unity.Application 0.1
@@ -23,6 +24,9 @@ import Unity.Application 0.1
2324Item {
2425 id: root
2526
27+ // to be set from Shell.qml
28+ property bool hasKeyboard
29+
2630 GlobalShortcut {
2731 shortcut: Qt.MetaModifier|Qt.Key_Space
2832 onTriggered: root.nextKeymap()
@@ -79,16 +83,31 @@ Item {
7983 }
8084
8185 onCurrentKeymapIndexChanged: {
82− print("!!! Current keymap index changed:", currentKeymapIndex)
8386 actionGroup.currentAction.updateState(currentKeymapIndex);
8487 }
8588
8689 readonly property int activeActionState: actionGroup.activeAction.valid ? actionGroup.activeAction.state : -1
8790
8891 onActiveActionStateChanged: {
89− print("!!! Active keymap changed (via indicator) to:", activeActionState);
9092 if (activeActionState != -1) {
9193 currentKeymapIndex = activeActionState;
9294 }
9395 }
96+
97+ // indicator visibility
98+ GSettings {
99+ id: settings
100+ schema.id: "com.canonical.indicator.keyboard"
101+ }
102+
103+ function updateIndicatorVisibility() {
104+ settings.visible = keymapCount > 1 && hasKeyboard;
105+ }
106+
107+ onHasKeyboardChanged: updateIndicatorVisibility();
108+ onKeymapCountChanged: updateIndicatorVisibility();
109+
110+ Component.onCompleted: {
111+ updateIndicatorVisibility();
112+ }
94113}