1/********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program. If not, see <http://www.gnu.org/licenses/>.
20*********************************************************************/
21
22// This file is #included from within:
23// Workspace::initShortcuts()
24// {
25
26// Some shortcuts have Tarzan-speech like names, they need extra
27// normal human descriptions with DEF2() the others can use DEF()
28// new DEF3 allows to pass data to the action, replacing the %1 argument in the name
29
30#define DEF2( name, descr, key, fnSlot ) \
31 a = actionCollection->addAction( name ); \
32 a->setText( i18n(descr) ); \
33 qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \
34 connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot));
35
36#define DEF( name, key, fnSlot ) \
37 DEF2(name, name, key, fnSlot)
38
39#define DEF3( name, key, fnSlot, value ) \
40 a = actionCollection->addAction( QString(name).arg(value) ); \
41 a->setText( i18n(name, value) ); \
42 qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \
43 a->setData(value); \
44 connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot));
45
46
47a = actionCollection->addAction("Program:kwin");
48a->setText(i18n("System"));
49
50a = actionCollection->addAction("Group:Navigation");
51a->setText(i18n("Navigation"));
52DEF(I18N_NOOP("Walk Through Window Tabs"), 0, slotActivateNextTab());
53DEF(I18N_NOOP("Walk Through Window Tabs (Reverse)"), 0, slotActivatePrevTab());
54DEF(I18N_NOOP("Remove Window From Group"), 0, slotUntab());
55
56a = actionCollection->addAction("Group:Windows");
57a->setText(i18n("Windows"));
58DEF(I18N_NOOP("Window Operations Menu"),
59 Qt::ALT + Qt::Key_F3, slotWindowOperations());
60DEF2("Window Close", I18N_NOOP("Close Window"),
61 Qt::ALT + Qt::Key_F4, slotWindowClose());
62DEF2("Window Maximize", I18N_NOOP("Maximize Window"),
63 0, slotWindowMaximize());
64DEF2("Window Maximize Vertical", I18N_NOOP("Maximize Window Vertically"),
65 0, slotWindowMaximizeVertical());
66DEF2("Window Maximize Horizontal", I18N_NOOP("Maximize Window Horizontally"),
67 0, slotWindowMaximizeHorizontal());
68DEF2("Window Minimize", I18N_NOOP("Minimize Window"),
69 0, slotWindowMinimize());
70DEF2("Window Shade", I18N_NOOP("Shade Window"),
71 0, slotWindowShade());
72DEF2("Window Move", I18N_NOOP("Move Window"),
73 0, slotWindowMove());
74DEF2("Window Resize", I18N_NOOP("Resize Window"),
75 0, slotWindowResize());
76DEF2("Window Raise", I18N_NOOP("Raise Window"),
77 0, slotWindowRaise());
78DEF2("Window Lower", I18N_NOOP("Lower Window"),
79 0, slotWindowLower());
80DEF(I18N_NOOP("Toggle Window Raise/Lower"),
81 0, slotWindowRaiseOrLower());
82DEF2("Window Fullscreen", I18N_NOOP("Make Window Fullscreen"),
83 0, slotWindowFullScreen());
84DEF2("Window No Border", I18N_NOOP("Hide Window Border"),
85 0, slotWindowNoBorder());
86DEF2("Window Above Other Windows", I18N_NOOP("Keep Window Above Others"),
87 0, slotWindowAbove());
88DEF2("Window Below Other Windows", I18N_NOOP("Keep Window Below Others"),
89 0, slotWindowBelow());
90DEF(I18N_NOOP("Activate Window Demanding Attention"),
91 Qt::CTRL + Qt::ALT + Qt::Key_A, slotActivateAttentionWindow());
92DEF(I18N_NOOP("Setup Window Shortcut"),
93 0, slotSetupWindowShortcut());
94DEF2("Window Pack Right", I18N_NOOP("Pack Window to the Right"),
95 0, slotWindowPackRight());
96DEF2("Window Pack Left", I18N_NOOP("Pack Window to the Left"),
97 0, slotWindowPackLeft());
98DEF2("Window Pack Up", I18N_NOOP("Pack Window Up"),
99 0, slotWindowPackUp());
100DEF2("Window Pack Down", I18N_NOOP("Pack Window Down"),
101 0, slotWindowPackDown());
102DEF2("Window Grow Horizontal", I18N_NOOP("Pack Grow Window Horizontally"),
103 0, slotWindowGrowHorizontal());
104DEF2("Window Grow Vertical", I18N_NOOP("Pack Grow Window Vertically"),
105 0, slotWindowGrowVertical());
106DEF2("Window Shrink Horizontal", I18N_NOOP("Pack Shrink Window Horizontally"),
107 0, slotWindowShrinkHorizontal());
108DEF2("Window Shrink Vertical", I18N_NOOP("Pack Shrink Window Vertically"),
109 0, slotWindowShrinkVertical());
110DEF2("Window Quick Tile Left", I18N_NOOP("Quick Tile Window to the Left"),
111 0, slotWindowQuickTileLeft());
112DEF2("Window Quick Tile Right", I18N_NOOP("Quick Tile Window to the Right"),
113 0, slotWindowQuickTileRight());
114DEF2("Window Quick Tile Top Left", I18N_NOOP("Quick Tile Window to the Top Left"),
115 0, slotWindowQuickTileTopLeft());
116DEF2("Window Quick Tile Bottom Left", I18N_NOOP("Quick Tile Window to the Bottom Left"),
117 0, slotWindowQuickTileBottomLeft());
118DEF2("Window Quick Tile Top Right", I18N_NOOP("Quick Tile Window to the Top Right"),
119 0, slotWindowQuickTileTopRight());
120DEF2("Window Quick Tile Bottom Right", I18N_NOOP("Quick Tile Window to the Bottom Right"),
121 0, slotWindowQuickTileBottomRight());
122DEF2("Switch Window Up", I18N_NOOP("Switch to Window Above"),
123 Qt::META + Qt::ALT + Qt::Key_Up, slotSwitchWindowUp());
124DEF2("Switch Window Down", I18N_NOOP("Switch to Window Below"),
125 Qt::META + Qt::ALT + Qt::Key_Down, slotSwitchWindowDown());
126DEF2("Switch Window Right", I18N_NOOP("Switch to Window to the Right"),
127 Qt::META + Qt::ALT + Qt::Key_Right, slotSwitchWindowRight());
128DEF2("Switch Window Left", I18N_NOOP("Switch to Window to the Left"),
129 Qt::META + Qt::ALT + Qt::Key_Left, slotSwitchWindowLeft());
130DEF2("Increase Opacity", I18N_NOOP("Increase Opacity of Active Window by 5 %"),
131 0, slotIncreaseWindowOpacity());
132DEF2("Decrease Opacity", I18N_NOOP("Decrease Opacity of Active Window by 5 %"),
133 0, slotLowerWindowOpacity());
134
135a = actionCollection->addAction("Group:Window Desktop");
136a->setText(i18n("Window & Desktop"));
137DEF2("Window On All Desktops", I18N_NOOP("Keep Window on All Desktops"),
138 0, slotWindowOnAllDesktops());
139
140for (int i = 1; i < 21; ++i) {
141 DEF3(I18N_NOOP("Window to Desktop %1"), 0, slotWindowToDesktop(), i);
142}
143DEF(I18N_NOOP("Window to Next Desktop"), 0, slotWindowToNextDesktop());
144DEF(I18N_NOOP("Window to Previous Desktop"), 0, slotWindowToPreviousDesktop());
145DEF(I18N_NOOP("Window One Desktop to the Right"), 0, slotWindowToDesktopRight());
146DEF(I18N_NOOP("Window One Desktop to the Left"), 0, slotWindowToDesktopLeft());
147DEF(I18N_NOOP("Window One Desktop Up"), 0, slotWindowToDesktopUp());
148DEF(I18N_NOOP("Window One Desktop Down"), 0, slotWindowToDesktopDown());
149
150for (int i = 0; i < 8; ++i) {
151 DEF3(I18N_NOOP("Window to Screen %1"), 0, slotWindowToScreen(), i);
152}
153DEF(I18N_NOOP("Window to Next Screen"), 0, slotWindowToNextScreen());
154DEF(I18N_NOOP("Window to Previous Screen"), 0, slotWindowToPrevScreen());
155DEF(I18N_NOOP("Show Desktop"), 0, slotToggleShowDesktop());
156
157for (int i = 0; i < 8; ++i) {
158 DEF3(I18N_NOOP("Switch to Screen %1"), 0, slotSwitchToScreen(), i);
159}
160
161DEF(I18N_NOOP("Switch to Next Screen"), 0, slotSwitchToNextScreen());
162DEF(I18N_NOOP("Switch to Previous Screen"), 0, slotSwitchToPrevScreen());
163
164a = actionCollection->addAction("Group:Miscellaneous");
165a->setText(i18n("Miscellaneous"));
166DEF(I18N_NOOP("Kill Window"), Qt::CTRL + Qt::ALT + Qt::Key_Escape, slotKillWindow());
167DEF(I18N_NOOP("Suspend Compositing"), Qt::SHIFT + Qt::ALT + Qt::Key_F12, slotToggleCompositing());
168DEF(I18N_NOOP("Invert Screen Colors"), 0, slotInvertScreen());
169
170#undef DEF
171#undef DEF2
172#undef DEF3
173
174// }
175