Add hotkey option to move active window to center

This commit is contained in:
Kristen McWilliam 2021-09-20 13:14:24 +00:00 committed by Vlad Zahorodnii
parent 69417dd5f7
commit 5fdf1da808
3 changed files with 16 additions and 0 deletions

View file

@ -719,6 +719,17 @@ void Workspace::slotWindowPackDown()
}
}
/** Moves the active window to the center of the screen. */
void Workspace::slotWindowCenter()
{
if (active_client && active_client->isMovable()) {
const QRect geometry = active_client->moveResizeGeometry();
QPoint center = clientArea(MaximizeArea, active_client).center();
active_client->packTo(center.x() - (geometry.width() / 2),
center.y() - (geometry.height() / 2));
}
}
void Workspace::slotWindowGrowHorizontal()
{
if (active_client)

View file

@ -1007,6 +1007,8 @@ void Workspace::initShortcuts()
Qt::CTRL + Qt::ALT + Qt::Key_A, slotActivateAttentionWindow);
DEF(I18N_NOOP("Setup Window Shortcut"),
0, slotSetupWindowShortcut);
DEF2("Window Move Center", I18N_NOOP("Move Window to the Center"), 0,
slotWindowCenter);
DEF2("Window Pack Right", I18N_NOOP("Pack Window to the Right"),
0, slotWindowPackRight);
DEF2("Window Pack Left", I18N_NOOP("Pack Window to the Left"),

View file

@ -441,6 +441,9 @@ public Q_SLOTS:
void slotWindowLower();
void slotWindowRaiseOrLower();
void slotActivateAttentionWindow();
void slotWindowCenter();
void slotWindowPackLeft();
void slotWindowPackRight();
void slotWindowPackUp();