on xenial help sign in
provide the close shortcut across stages
024ddd2Lukáš Tinkl
qml/Stages/DesktopStage.qml+4−2
@@ -50,8 +50,8 @@ AbstractStage {
50 GlobalShortcut {
50 GlobalShortcut {
51 id: closeWindowShortcut
51 id: closeWindowShortcut
52 shortcut: Qt.AltModifier|Qt.Key_F4
52 shortcut: Qt.AltModifier|Qt.Key_F4
53− onTriggered: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
53+ onTriggered: priv.focusedAppDelegate.close();
54− active: priv.focusedAppDelegate !== null
54+ active: priv.focusedAppDelegate && !priv.focusedAppDelegate.isDash
55 }
55 }
56
56
57 GlobalShortcut {
57 GlobalShortcut {
@@ -298,6 +298,8 @@ AbstractStage {
298
298
299 readonly property var surface: model.surface
299 readonly property var surface: model.surface
300
300
301+ readonly property bool isDash: model.application.appId == "unity8-dash"
302+
301 function claimFocus() {
303 function claimFocus() {
302 if (spread.state == "altTab") {
304 if (spread.state == "altTab") {
303 spread.cancel();
305 spread.cancel();
qml/Stages/PhoneStage.qml+7
@@ -20,6 +20,7 @@ import Ubuntu.Gestures 0.1
20import Unity.Application 0.1
20import Unity.Application 0.1
21import Unity.Session 0.1
21import Unity.Session 0.1
22import Utils 0.1
22import Utils 0.1
23+import GlobalShortcut 1.0
23import Powerd 0.1
24import Powerd 0.1
24import "../Components"
25import "../Components"
25
26
@@ -126,6 +127,12 @@ AbstractStage {
126
127
127 signal opened()
128 signal opened()
128
129
130+ GlobalShortcut {
131+ shortcut: Qt.AltModifier|Qt.Key_F4
132+ onTriggered: priv.focusedAppDelegate.closed()
133+ active: priv.focusedAppDelegate && !priv.focusedAppDelegate.isDash
134+ }
135+
129 function select(appId) {
136 function select(appId) {
130 spreadView.snapTo(priv.indexOf(appId));
137 spreadView.snapTo(priv.indexOf(appId));
131 }
138 }
qml/Stages/TabletStage.qml+7
@@ -19,6 +19,7 @@ import Ubuntu.Components 1.3
19import Ubuntu.Gestures 0.1
19import Ubuntu.Gestures 0.1
20import Unity.Application 0.1
20import Unity.Application 0.1
21import Utils 0.1
21import Utils 0.1
22+import GlobalShortcut 1.0
22import Powerd 0.1
23import Powerd 0.1
23import "../Components"
24import "../Components"
24
25
@@ -114,6 +115,12 @@ AbstractStage {
114 }
115 }
115 }
116 }
116
117
118+ GlobalShortcut {
119+ shortcut: Qt.AltModifier|Qt.Key_F4
120+ onTriggered: priv.focusedAppDelegate.closed()
121+ active: priv.focusedAppDelegate && priv.focusedAppDelegate.isDash
122+ }
123+
117 // How far left the stage has been dragged, used externally by tutorial code
124 // How far left the stage has been dragged, used externally by tutorial code
118 dragProgress: spreadRepeater.count > 0 ? spreadRepeater.itemAt(0).animatedProgress : 0
125 dragProgress: spreadRepeater.count > 0 ? spreadRepeater.itemAt(0).animatedProgress : 0
119
126