on xenial help sign in
implement Ctrl+Alt+T to launch the terminal app
9e458f4Lukáš Tinkl
qml/Components/KeyboardShortcutsOverlay.qml+13
@@ -110,6 +110,19 @@ Rectangle {
110 Layout.maximumWidth: maxTextSize
110 Layout.maximumWidth: maxTextSize
111 }
111 }
112
112
113+ Label {
114+ text: i18n.tr("Ctrl + Alt + T")
115+ fontSize: "small"
116+ font.weight: Font.Medium
117+ }
118+ Label {
119+ text: i18n.tr("Starts the terminal application.")
120+ fontSize: "small"
121+ font.weight: Font.Light
122+ wrapMode: Text.Wrap
123+ Layout.maximumWidth: maxTextSize
124+ }
125+
113
126
114 // Launcher section
127 // Launcher section
115 Item { Layout.columnSpan: 2; height: units.gu(2) }
128 Item { Layout.columnSpan: 2; height: units.gu(2) }
qml/Stage/Stage.qml+15
@@ -224,6 +224,21 @@ FocusScope {
224 active: priv.focusedAppDelegate !== null
224 active: priv.focusedAppDelegate !== null
225 }
225 }
226
226
227+ GlobalShortcut {
228+ shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_T
229+ onTriggered: {
230+ const termAppName = "ubuntu-terminal-app";
231+ var termInfo = root.applicationManager.findApplication(termAppName);
232+ if (termInfo) {
233+ if (!termInfo.focused) {
234+ root.applicationManager.requestFocusApplication(termAppName);
235+ }
236+ } else {
237+ root.applicationManager.startApplication(termAppName);
238+ }
239+ }
240+ }
241+
227 QtObject {
242 QtObject {
228 id: priv
243 id: priv
229 objectName: "DesktopStagePrivate"
244 objectName: "DesktopStagePrivate"
tests/mocks/Unity/Application/ApplicationManager.cpp+5
@@ -476,6 +476,11 @@ void ApplicationManager::buildListOfAvailableApplications()
476 application->setIsTouchApp(false);
476 application->setIsTouchApp(false);
477 m_availableApplications.append(application);
477 m_availableApplications.append(application);
478
478
479+ application = new ApplicationInfo(this);
480+ application->setAppId("ubuntu-terminal-app");
481+ application->setName("Terminal");
482+ m_availableApplications.append(application);
483+
479 application = new ApplicationInfo(this);
484 application = new ApplicationInfo(this);
480 application->setAppId("primary-oriented-app");
485 application->setAppId("primary-oriented-app");
481 application->setName("Primary Oriented");
486 application->setName("Primary Oriented");
tests/qmltests/tst_Shell.qml+19
@@ -1460,6 +1460,25 @@ Rectangle {
1460 confirmLoggedIn(true);
1460 confirmLoggedIn(true);
1461 }
1461 }
1462
1462
1463+ function test_terminalShortcut() {
1464+ loadShell("desktop");
1465+ shell.usageScenario = "desktop";
1466+ waitForRendering(shell);
1467+ swipeAwayGreeter();
1468+
1469+ // not running, should start
1470+ keyClick(Qt.Key_T, Qt.ControlModifier|Qt.AltModifier);
1471+ tryCompare(ApplicationManager, "focusedApplicationId", "ubuntu-terminal-app");
1472+
1473+ // start something else
1474+ ApplicationManager.startApplication("dialer-app");
1475+ tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
1476+
1477+ // terminal running in background, should get focused
1478+ keyClick(Qt.Key_T, Qt.ControlModifier|Qt.AltModifier);
1479+ tryCompare(ApplicationManager, "focusedApplicationId", "ubuntu-terminal-app");
1480+ }
1481+
1463 function test_launcherInverted_data() {
1482 function test_launcherInverted_data() {
1464 return [
1483 return [
1465 {tag: "phone", formFactor: "phone", usageScenario: "phone", launcherInverted: true},
1484 {tag: "phone", formFactor: "phone", usageScenario: "phone", launcherInverted: true},