@@ -28,6 +28,26 @@ Item {
29 property alias background: wallpaper.source
29 property alias background: wallpaper.source
31+ property bool altTabPressed: false
33+ onAltTabPressedChanged: {
34+ print("Alt+Tab pressed:", altTabPressed)
36+ appRepeater.highlightedIndex = 1;
38+ print("focusing app", appRepeater.highlightedIndex)
39+ ApplicationManager.focusApplication(ApplicationManager.get(appRepeater.highlightedIndex).appId)
43+ function altTabNext() {
44+ if (root.altTabPressed) {
45+ print("should tab next")
46+ appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count
47+ spreadFlickable.snapTo(spreadFlickable.width / 5 * Math.max(0, appRepeater.highlightedIndex - 3))
31 CrossFadeImage {
51 CrossFadeImage {
32 id: wallpaper
52 id: wallpaper
33 anchors.fill: parent
53 anchors.fill: parent
@@ -83,63 +103,139 @@ Item {
83 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.state === "maximized"
103 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.state === "maximized"
86− Repeater {
107+ Repeater {
87− id: appRepeater
108+ id: appRepeater
88− model: ApplicationManager
109+ model: ApplicationManager
90− delegate: Item {
111+ property int highlightedIndex: 1
92− z: ApplicationManager.count - index
97− readonly property int minWidth: units.gu(10)
113+ delegate: Item {
98− readonly property int minHeight: units.gu(10)
114+ id: appDelegate
115+ z: ApplicationManager.count - index
118+ height: units.gu(50)
100− function focusWindow() {
120+ readonly property int minWidth: units.gu(10)
101− decoratedWindow.window.forceActiveFocus();
121+ readonly property int minHeight: units.gu(10)
104− states: [
123+ function focusWindow() {
105− State {
124+ decoratedWindow.window.forceActiveFocus();
110− PropertyChanges { target: appDelegate; x: 0; y: 0; width: root.width; height: root.height }
114− PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
133+ PropertyChanges { target: appDelegate; x: 0; y: 0; width: root.width; height: root.height }
137+ PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
140+ name: "altTab"; when: root.state == "altTab"
143+ x: spreadMaths.desktopX(index, root.width, spreadFlickable.contentX)
144+ y: spreadMaths.desktopY(root.height, appDelegate.height)
145+ angle: spreadMaths.desktopAngle(index, spreadFlickable.contentX)
150+ target: darkenOverlay
151+ opacity: index != appRepeater.highlightedIndex ? 0.4 : 0
117− transitions: [
155+ transitions: [
118− Transition {
156+ Transition {
157+ from: "maximized,minimized,normal,"
158+ to: "maximized,minimized,normal,"
119− PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }
159+ PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }
162+ property real angle: 0
165+ origin { x: 0; y: appDelegate.height / 2 }
166+ axis { x: 0; y: 1; z: 0 }
167+ angle: appDelegate.angle
123− WindowMoveResizeArea {
175+ WindowMoveResizeArea {
124− target: appDelegate
176+ target: appDelegate
125− minWidth: appDelegate.minWidth
177+ minWidth: appDelegate.minWidth
126− minHeight: appDelegate.minHeight
178+ minHeight: appDelegate.minHeight
127− resizeHandleWidth: units.gu(0.5)
179+ resizeHandleWidth: units.gu(0.5)
128− windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
180+ windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
130− onPressed: ApplicationManager.requestFocusApplication(model.appId)
182+ onPressed: ApplicationManager.requestFocusApplication(model.appId)
187+ anchors.fill: parent
188+ application: ApplicationManager.get(index)
189+ active: ApplicationManager.focusedApplicationId === model.appId
135− anchors.fill: parent
136− application: ApplicationManager.get(index)
191+ onClose: ApplicationManager.stopApplication(model.appId)
137− active: ApplicationManager.focusedApplicationId === model.appId
192+ onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")
193+ onMinimize: appDelegate.state = "minimized"
139− onClose: ApplicationManager.stopApplication(model.appId)
196+ Rectangle {
140− onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")
197+ id: darkenOverlay
141− onMinimize: appDelegate.state = "minimized"
198+ anchors.fill: parent
208+ anchors.fill: parent
209+ contentWidth: ApplicationManager.count * width / 5
211+ onContentXChanged: print("flickable flicked", contentX)
213+ function snapTo(contentX) {
214+ snapAnimation.to = contentX
215+ snapAnimation.start();
218+ UbuntuNumberAnimation {
220+ target: spreadFlickable
221+ property: "contentX"
230+ name: "altTab"; when: root.altTabPressed
231+ PropertyChanges { target: spreadFlickable; visible: true }
238+ PropertyAction { target: spreadFlickable; property: "contentX"; value: 0 }