@@ -55,46 +55,6 @@ Rectangle {
55 property alias background: wallpaper.source
55 property alias background: wallpaper.source
56 property bool altTabPressed: false
56 property bool altTabPressed: false
58− onAltTabPressedChanged: {
59− if (!altTabPressed && root.state == "altTab") {
60− print("released", appRepeater.highlightedIndex)
61− ApplicationManager.requestFocusApplication(ApplicationManager.get(appRepeater.highlightedIndex).appId)
65− function altTabNext(isAutoRepeat) {
66− if (root.altTabPressed) {
67− print("should tab next", isAutoRepeat, "highlightedIndex is", appRepeater.highlightedIndex)
68− if (isAutoRepeat && appRepeater.highlightedIndex >= ApplicationManager.count -1) {
69− return; // AutoRepeat is not allowed to wrap around
72− appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count;
73− print("new highlighted index", appRepeater.highlightedIndex)
74− var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 3));
75− if (spreadFlickable.contentX < newContentX || appRepeater.highlightedIndex == 0) {
76− spreadFlickable.snapTo(newContentX)
81− function altTabPrevious(isAutoRepeat) {
82− print("alttabprevious pressed")
83− if (root.altTabPressed) {
84− if (isAutoRepeat && appRepeater.highlightedIndex == 0) {
85− return; // AutoRepeat is not allowed to wrap around
88− var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
89− print("setting highlighted to", newIndex)
90− appRepeater.highlightedIndex = newIndex;
91− var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 1));
92− if (spreadFlickable.contentX > newContentX || newIndex == ApplicationManager.count -1) {
93− spreadFlickable.snapTo(newContentX)
98 CrossFadeImage {
58 CrossFadeImage {
99 id: wallpaper
59 id: wallpaper
100 anchors.fill: parent
60 anchors.fill: parent
@@ -165,9 +125,60 @@ Rectangle {
165 visible: false
125 visible: false
168− Item {
128+ FocusScope {
169 id: appContainer
129 id: appContainer
170 anchors.fill: parent
130 anchors.fill: parent
133+ switch (event.key) {
135+ case Qt.Key_Backtab:
136+ selectPrevious(event.isAutoRepeat)
140+ selectNext(event.isAutoRepeat)
143+ appRepeater.highlightedIndex = -1
151+ function selectNext(isAutoRepeat) {
152+ if (isAutoRepeat && appRepeater.highlightedIndex >= ApplicationManager.count -1) {
153+ return; // AutoRepeat is not allowed to wrap around
156+ appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count;
157+ var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 3));
158+ if (spreadFlickable.contentX < newContentX || appRepeater.highlightedIndex == 0) {
159+ spreadFlickable.snapTo(newContentX)
163+ function selectPrevious(isAutoRepeat) {
164+ if (isAutoRepeat && appRepeater.highlightedIndex == 0) {
165+ return; // AutoRepeat is not allowed to wrap around
168+ var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
169+ appRepeater.highlightedIndex = newIndex;
170+ var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 1));
171+ if (spreadFlickable.contentX > newContentX || newIndex == ApplicationManager.count -1) {
172+ spreadFlickable.snapTo(newContentX)
176+ function focusSelected() {
177+ if (appRepeater.highlightedIndex != -1) {
178+ appRepeater.itemAt(appRepeater.highlightedIndex).focus = true;
171 Repeater {
182 Repeater {
172 id: appRepeater
183 id: appRepeater
173 model: ApplicationManager
184 model: ApplicationManager
@@ -521,6 +532,7 @@ Rectangle {
521 PropertyChanges { target: spreadFlickable; enabled: true }
532 PropertyChanges { target: spreadFlickable; enabled: true }
522 PropertyChanges { target: currentSelectedLabel; visible: true }
533 PropertyChanges { target: currentSelectedLabel; visible: true }
523 PropertyChanges { target: spreadBackground; visible: true }
534 PropertyChanges { target: spreadBackground; visible: true }
535+ PropertyChanges { target: appContainer; focus: true }
526 signal updateWorkspaces();
538 signal updateWorkspaces();
@@ -530,7 +542,7 @@ Rectangle {
530 from: "*"
542 from: "*"
531 to: "altTab"
543 to: "altTab"
532 SequentialAnimation {
544 SequentialAnimation {
533− PropertyAction { target: appRepeater; property: "highlightedIndex"; value: 1 }
545+ PropertyAction { target: appRepeater; property: "highlightedIndex"; value: Math.min(ApplicationManager.count - 1, 1) }
534 PauseAnimation { duration: 50 }
546 PauseAnimation { duration: 50 }
535 PropertyAction { target: workspaceSelector; property: "visible" }
547 PropertyAction { target: workspaceSelector; property: "visible" }
536 ScriptAction { script: root.updateWorkspaces() }
548 ScriptAction { script: root.updateWorkspaces() }
@@ -547,6 +559,7 @@ Rectangle {
548 PropertyAnimation { property: "opacity" }
560 PropertyAnimation { property: "opacity" }
549 PropertyAction { target: root; property: "workspacesUpdated"; value: false }
561 PropertyAction { target: root; property: "workspacesUpdated"; value: false }
562+ ScriptAction { script: { appContainer.focusSelected() } }
550 PropertyAction { target: appRepeater; property: "highlightedIndex"; value: -1 }
563 PropertyAction { target: appRepeater; property: "highlightedIndex"; value: -1 }