From f1f97bb3956be03151bb1741cfb44429a0f724d9 Mon Sep 17 00:00:00 2001 From: Nathaniel Graham Date: Thu, 15 Mar 2018 22:37:48 -0600 Subject: [PATCH] Expose more default window management shortcuts Summary: KWin's window management powers are not as discoverable as they could be--particularly tiling, which by default has no visible UI and no keyboard shortcuts. Resolving this issue is highly relevant to {T6831}. This patch re-assigns the {key Meta arrowkeys} shortcuts that are currently used for `move zoomed area` (which are pretty esoteric, infrequently-used actions), adding {key ctrl} to their shortcuts. This allows us to use their valuable {key Meta arrowkeys} for more useful and commonly-used window management actions: - {key Meta Left}: quick tile window to the left - {key Meta Right}: quick tile window to the right - {key Meta Up}: quick-tile window to the top - {key Meta Down}: quick-tile the window to the bottom The patch also sets some default shortctuts for minimize and maximize: - {key Meta PageDown}: minimize window - {key Meta PageUp}: maximize/de-maximize the window Test Plan: Do a clean build `make test` (no new test failures) Reboot Create and log into a new user account - {key meta up} tiles the active window to the top - {key meta down} tiles the active window to the bottom - {key meta left} tiles the active window to the left - {key meta right} tiles the active window to the right - {key meta PageDown} minimizes the active window - {key meta PageUp} maximizes and de-maximizes the active window - {key meta ctrl up} moves the zoomed area up - {key meta ctrl down} moves the zoomed area down - {key meta ctrl left} moves the zoomed area to the left - {key meta ctrl right} moves the zoomed area to the right Reviewers: #kwin, #plasma, romangg Reviewed By: #kwin, #plasma, romangg Subscribers: mart, romangg, broulik, jnoack, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D11377 --- effects/zoom/zoom.cpp | 24 ++++++++++++------------ effects/zoom/zoom_config.cpp | 16 ++++++++-------- kwinbindings.cpp | 12 ++++++------ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index 9ea94cac96..6719137151 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -82,33 +82,33 @@ ZoomEffect::ZoomEffect() a = new QAction(this); a->setObjectName(QStringLiteral("MoveZoomLeft")); a->setText(i18n("Move Zoomed Area to Left")); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Left); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Left); - effects->registerGlobalShortcut(Qt::META + Qt::Key_Left, a); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Left); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Left); + effects->registerGlobalShortcut(Qt::META + Qt::CTRL + Qt::Key_Left, a); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomLeft())); a = new QAction(this); a->setObjectName(QStringLiteral("MoveZoomRight")); a->setText(i18n("Move Zoomed Area to Right")); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Right); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Right); - effects->registerGlobalShortcut(Qt::META + Qt::Key_Right, a); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Right); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Right); + effects->registerGlobalShortcut(Qt::META + Qt::CTRL + Qt::Key_Right, a); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomRight())); a = new QAction(this); a->setObjectName(QStringLiteral("MoveZoomUp")); a->setText(i18n("Move Zoomed Area Upwards")); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Up); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Up); - effects->registerGlobalShortcut(Qt::META + Qt::Key_Up, a); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Up); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Up); + effects->registerGlobalShortcut(Qt::META + Qt::CTRL + Qt::Key_Up, a); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomUp())); a = new QAction(this); a->setObjectName(QStringLiteral("MoveZoomDown")); a->setText(i18n("Move Zoomed Area Downwards")); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Down); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Down); - effects->registerGlobalShortcut(Qt::META + Qt::Key_Down, a); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Down); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Down); + effects->registerGlobalShortcut(Qt::META + Qt::CTRL + Qt::Key_Down, a); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomDown())); // TODO: these two actions don't belong into the effect. They need to be moved into KWin core diff --git a/effects/zoom/zoom_config.cpp b/effects/zoom/zoom_config.cpp index f7e0d1b1b5..9bc02e4176 100644 --- a/effects/zoom/zoom_config.cpp +++ b/effects/zoom/zoom_config.cpp @@ -86,29 +86,29 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) : a->setIcon(QIcon::fromTheme(QStringLiteral("go-previous"))); a->setText(i18n("Move Left")); a->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Left); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Left); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Left); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Left); a = actionCollection->addAction(QStringLiteral("MoveZoomRight")); a->setIcon(QIcon::fromTheme(QStringLiteral("go-next"))); a->setText(i18n("Move Right")); a->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Right); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Right); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Right); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Right); a = actionCollection->addAction(QStringLiteral("MoveZoomUp")); a->setIcon(QIcon::fromTheme(QStringLiteral("go-up"))); a->setText(i18n("Move Up")); a->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Up); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Up); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Up); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Up); a = actionCollection->addAction(QStringLiteral("MoveZoomDown")); a->setIcon(QIcon::fromTheme(QStringLiteral("go-down"))); a->setText(i18n("Move Down")); a->setProperty("isConfigurationAction", true); - KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Down); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Down); + KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Down); + KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_Down); a = actionCollection->addAction(QStringLiteral("MoveMouseToFocus")); a->setIcon(QIcon::fromTheme(QStringLiteral("view-restore"))); diff --git a/kwinbindings.cpp b/kwinbindings.cpp index bbdd75a5e3..40e98f0e1c 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -55,13 +55,13 @@ DEF(I18N_NOOP("Window Operations Menu"), DEF2("Window Close", I18N_NOOP("Close Window"), Qt::ALT + Qt::Key_F4, slotWindowClose); DEF2("Window Maximize", I18N_NOOP("Maximize Window"), - 0, slotWindowMaximize); + Qt::META + Qt::Key_PageUp, slotWindowMaximize); DEF2("Window Maximize Vertical", I18N_NOOP("Maximize Window Vertically"), 0, slotWindowMaximizeVertical); DEF2("Window Maximize Horizontal", I18N_NOOP("Maximize Window Horizontally"), 0, slotWindowMaximizeHorizontal); DEF2("Window Minimize", I18N_NOOP("Minimize Window"), - 0, slotWindowMinimize); + Qt::META + Qt::Key_PageDown, slotWindowMinimize); DEF2("Window Shade", I18N_NOOP("Shade Window"), 0, slotWindowShade); DEF2("Window Move", I18N_NOOP("Move Window"), @@ -103,13 +103,13 @@ DEF2("Window Shrink Horizontal", I18N_NOOP("Pack Shrink Window Horizontally"), DEF2("Window Shrink Vertical", I18N_NOOP("Pack Shrink Window Vertically"), 0, slotWindowShrinkVertical); DEF4("Window Quick Tile Left", I18N_NOOP("Quick Tile Window to the Left"), - 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Left)); + Qt::META + Qt::Key_Left, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Left)); DEF4("Window Quick Tile Right", I18N_NOOP("Quick Tile Window to the Right"), - 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Right)); + Qt::META + Qt::Key_Right, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Right)); DEF4("Window Quick Tile Top", I18N_NOOP("Quick Tile Window to the Top"), - 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Top)); + Qt::META + Qt::Key_Up, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Top)); DEF4("Window Quick Tile Bottom", I18N_NOOP("Quick Tile Window to the Bottom"), - 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Bottom)); + Qt::META + Qt::Key_Down, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Bottom)); DEF4("Window Quick Tile Top Left", I18N_NOOP("Quick Tile Window to the Top Left"), 0, std::bind(&Workspace::quickTileWindow, this, QuickTileFlag::Top | QuickTileFlag::Left)); DEF4("Window Quick Tile Bottom Left", I18N_NOOP("Quick Tile Window to the Bottom Left"),