diff --git a/qml/Components/KeyboardShortcutsOverlay.qml b/qml/Components/KeyboardShortcutsOverlay.qml index 65eca6554..0db7934ce 100644 --- a/qml/Components/KeyboardShortcutsOverlay.qml +++ b/qml/Components/KeyboardShortcutsOverlay.qml @@ -328,6 +328,42 @@ Rectangle { wrapMode: Text.Wrap Layout.maximumWidth: maxTextSize } + + // Stages section + Item { Layout.columnSpan: 2; height: units.gu(2) } + Label { + Layout.columnSpan: 2 + text: i18n.tr("Stages") + font.weight: Font.Light + color: theme.palette.normal.baseText + lineHeight: 1.3 + } + + Label { + text: i18n.tr("Super + S") + fontSize: "small" + font.weight: Font.Medium + } + Label { + text: i18n.tr("Shows or hides the side stage.") + fontSize: "small" + font.weight: Font.Light + wrapMode: Text.Wrap + Layout.maximumWidth: maxTextSize + } + + Label { + text: i18n.tr("Ctrl + Super + Left or Right") + fontSize: "small" + font.weight: Font.Medium + } + Label { + text: i18n.tr("Moves app between main stage and side stage.") + fontSize: "small" + font.weight: Font.Light + wrapMode: Text.Wrap + Layout.maximumWidth: maxTextSize + } } Item { Layout.fillHeight: true; Layout.columnSpan: 2 } // spacer diff --git a/qml/Stage/Stage.qml b/qml/Stage/Stage.qml index 8c97bc449..fa7b8d859 100644 --- a/qml/Stage/Stage.qml +++ b/qml/Stage/Stage.qml @@ -206,6 +206,15 @@ FocusScope { onTriggered: priv.goneToSpread = true } + GlobalShortcut { + id: toggleSideStageShortcut + shortcut: Qt.MetaModifier|Qt.Key_S + active: priv.sideStageEnabled + onTriggered: { + priv.toggleSideStage() + } + } + GlobalShortcut { id: minimizeAllShortcut shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_D @@ -223,15 +232,43 @@ FocusScope { GlobalShortcut { id: maximizeWindowLeftShortcut shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Left - onTriggered: priv.focusedAppDelegate.requestMaximizeLeft() - active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight + onTriggered: { + switch (root.mode) { + case "stagedWithSideStage": + if (priv.focusedAppDelegate.stage == ApplicationInfoInterface.SideStage) { + priv.focusedAppDelegate.saveStage(ApplicationInfoInterface.MainStage); + priv.focusedAppDelegate.focus = true; + } + break; + case "windowed": + priv.focusedAppDelegate.requestMaximizeLeft() + break; + } + } + active: (root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight) + || (root.state == "stagedWithSideStage" && priv.focusedAppDelegate.stage == ApplicationInfoInterface.SideStage) } GlobalShortcut { id: maximizeWindowRightShortcut shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Right - onTriggered: priv.focusedAppDelegate.requestMaximizeRight() - active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight + onTriggered: { + switch (root.mode) { + case "stagedWithSideStage": + if (priv.focusedAppDelegate.stage == ApplicationInfoInterface.MainStage) { + priv.focusedAppDelegate.saveStage(ApplicationInfoInterface.SideStage); + priv.focusedAppDelegate.focus = true; + sideStage.show(); + priv.updateMainAndSideStageIndexes() + } + break; + case "windowed": + priv.focusedAppDelegate.requestMaximizeRight() + break; + } + } + active: (root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight) + || (root.state == "stagedWithSideStage" && priv.focusedAppDelegate.stage == ApplicationInfoInterface.MainStage) } GlobalShortcut { @@ -330,6 +367,15 @@ FocusScope { } } + function toggleSideStage() { + if (sideStage.shown) { + sideStage.hide(); + } else { + sideStage.show(); + updateMainAndSideStageIndexes() + } + } + function updateMainAndSideStageIndexes() { if (root.mode != "stagedWithSideStage") { priv.sideStageDelegate = null; @@ -2189,12 +2235,7 @@ FocusScope { } onClicked: { - if (sideStage.shown) { - sideStage.hide(); - } else { - sideStage.show(); - priv.updateMainAndSideStageIndexes() - } + priv.toggleSideStage() } onDragStarted: {