@@ -578,11 +578,14 @@ AbstractStage {
578578 readonly property alias resizeArea: resizeArea
579579
580580 function claimFocus() {
581− appDelegate.focus = true;
582581 print("focusing app", priv.sideStageDelegate, appDelegate, sideStage.shown)
582+ if (root.mode == "windowed" && minimized) {
583+ restore(true)
584+ }
583585 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
584586 sideStage.show();
585587 }
588+ appDelegate.focus = true;
586589 }
587590 Connections {
588591 target: model.surface
@@ -1008,11 +1011,14 @@ AbstractStage {
10081011 State {
10091012 name: "minimized"; when: appDelegate.minimized
10101013 PropertyChanges {
1011− target: appDelegate;
1014+ target: appDelegate
1015+ requestedWidth: decoratedWindow.oldRequestedWidth
1016+ requestedHeight: decoratedWindow.oldRequestedHeight
10121017 x: -appDelegate.width / 2;
1013− scale: units.gu(5) / appDelegate.width;
1018+ y: requestedY // TODO: Should be where the icon is in the launcher. Lets just move it horizontally to the left for now.
1019+ scale: units.gu(5) / appDelegate.width
10141020 opacity: 0;
1015− visuallyMinimized: true;
1021+ visuallyMinimized: true
10161022 visuallyMaximized: false
10171023 }
10181024 }
@@ -1026,10 +1032,10 @@ AbstractStage {
10261032 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
10271033 },
10281034 Transition {
1029− from: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight"; to: "normal"
1035+ from: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,minimized"; to: "normal"
10301036 enabled: appDelegate.animationsEnabled
10311037 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1032− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration }
1038+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
10331039 },
10341040 Transition {
10351041 from: "normal"; to: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight"