Merge lp:~saviq/unity-2d/add-newwindow-shortcuts into lp:unity-2d

Proposed by Michał Sawicz
Status: Merged
Approved by: Gerry Boland
Approved revision: 741
Merged at revision: 741
Proposed branch: lp:~saviq/unity-2d/add-newwindow-shortcuts
Merge into: lp:unity-2d
Diff against target: 74 lines (+23/-6)
3 files modified
launcher/LauncherList.qml (+8/-1)
launcher/app/launcherview.cpp (+13/-4)
launcher/app/launcherview.h (+2/-1)
To merge this branch: bzr merge lp:~saviq/unity-2d/add-newwindow-shortcuts
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+77473@code.launchpad.net

Commit message

[panel] use super+shift+<number> to launch new instance of an application

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Works great, in!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/LauncherList.qml'
2--- launcher/LauncherList.qml 2011-08-31 14:22:49 +0000
3+++ launcher/LauncherList.qml 2011-09-29 07:57:26 +0000
4@@ -306,13 +306,20 @@
5
6 Connections {
7 target: launcherView
8- onKeyboardShortcutPressed: {
9+ onActivateShortcutPressed: {
10 /* Only applications can be launched by keyboard shortcuts */
11 if (item.toString().indexOf("LauncherApplication") == 0 && index == itemIndex) {
12 item.menu.hide()
13 item.activate()
14 }
15 }
16+ onNewInstanceShortcutPressed: {
17+ /* Only applications can be launched by keyboard shortcuts */
18+ if (item.toString().indexOf("LauncherApplication") == 0 && index == itemIndex) {
19+ item.menu.hide()
20+ item.launchNewInstance()
21+ }
22+ }
23 }
24 }
25 }
26
27=== modified file 'launcher/app/launcherview.cpp'
28--- launcher/app/launcherview.cpp 2011-09-19 19:07:41 +0000
29+++ launcher/app/launcherview.cpp 2011-09-29 07:57:26 +0000
30@@ -87,6 +87,8 @@
31 for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) {
32 Hotkey* hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier);
33 connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey()));
34+ hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier | Qt::ShiftModifier);
35+ connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey()));
36 }
37 }
38
39@@ -204,10 +206,17 @@
40 Qt::Key key = hotkey->key();
41 if (key >= Qt::Key_1 && key <= Qt::Key_9) {
42 int index = key - Qt::Key_0;
43- Q_EMIT keyboardShortcutPressed(index);
44- }
45- else if (key == Qt::Key_0){
46- Q_EMIT keyboardShortcutPressed(10);
47+ if (hotkey->modifiers() & Qt::ShiftModifier) {
48+ Q_EMIT newInstanceShortcutPressed(index);
49+ } else {
50+ Q_EMIT activateShortcutPressed(index);
51+ }
52+ } else if (key == Qt::Key_0) {
53+ if (hotkey->modifiers() & Qt::ShiftModifier) {
54+ Q_EMIT newInstanceShortcutPressed(10);
55+ } else {
56+ Q_EMIT activateShortcutPressed(10);
57+ }
58 }
59 }
60 }
61
62=== modified file 'launcher/app/launcherview.h'
63--- launcher/app/launcherview.h 2011-09-15 18:05:15 +0000
64+++ launcher/app/launcherview.h 2011-09-29 07:57:26 +0000
65@@ -45,7 +45,8 @@
66 bool superKeyHeld() const { return m_superKeyHeld; }
67
68 Q_SIGNALS:
69- void keyboardShortcutPressed(int itemIndex);
70+ void activateShortcutPressed(int itemIndex);
71+ void newInstanceShortcutPressed(int itemIndex);
72 void superKeyHeldChanged(bool superKeyHeld);
73 void superKeyTapped();
74 void addWebFavoriteRequested(const QUrl& url);

Subscribers

People subscribed via source and target branches