Change global shortcuts to use the Meta key by default

The current shortcuts could conceivably override app shortcuts, since
they don't use the Meta key. The following changes are made:

Switch keyboard layout:               Ctrl+Alt+K   -> Meta+Alt+K
Activate window that wants attention: Ctrl+Alt+A   -> Meta+Ctrl+A
Kill Window:                          Ctrl+Alt+Esc -> Meta+Ctrl+Esc

These are safe to change in the code rather than adding new ones and
keeping the old ones around for compatibility's sake because
KGlobalAccel::setDefaultShortcuts by default preserves old shortcuts
when they are changed, and we aren't overriding that behavior here. So
only new installs will get the new shortcuts and existing user installs
will be untouched.
This commit is contained in:
Nate Graham 2022-05-27 10:18:02 -06:00
parent 9db4fd1a17
commit 529c3c29d3
2 changed files with 4 additions and 3 deletions

View file

@ -44,9 +44,10 @@ void KeyboardLayout::init()
switchKeyboardAction->setObjectName(QStringLiteral("Switch to Next Keyboard Layout"));
switchKeyboardAction->setProperty("componentName", QStringLiteral("KDE Keyboard Layout Switcher"));
switchKeyboardAction->setProperty("componentDisplayName", i18n("Keyboard Layout Switcher"));
const QKeySequence sequence = QKeySequence(Qt::ALT | Qt::CTRL | Qt::Key_K);
const QKeySequence sequence = QKeySequence(Qt::META | Qt::ALT | Qt::Key_K);
KGlobalAccel::self()->setDefaultShortcut(switchKeyboardAction, QList<QKeySequence>({sequence}));
KGlobalAccel::self()->setShortcut(switchKeyboardAction, QList<QKeySequence>({sequence}));
kwinApp()->platform()->setupActionForGlobalAccel(switchKeyboardAction);
connect(switchKeyboardAction, &QAction::triggered, this, &KeyboardLayout::switchToNextLayout);

View file

@ -1017,7 +1017,7 @@ void Workspace::initShortcuts()
DEF2("Window Below Other Windows", kli18n("Keep Window Below Others"),
0, slotWindowBelow);
DEF(kli18n("Activate Window Demanding Attention"),
Qt::CTRL | Qt::ALT | Qt::Key_A, slotActivateAttentionWindow);
Qt::META | Qt::CTRL | Qt::Key_A, slotActivateAttentionWindow);
DEF(kli18n("Setup Window Shortcut"),
0, slotSetupWindowShortcut);
DEF2("Window Move Center", kli18n("Move Window to the Center"), 0,
@ -1101,7 +1101,7 @@ void Workspace::initShortcuts()
DEF(kli18n("Switch to Next Screen"), 0, slotSwitchToNextScreen);
DEF(kli18n("Switch to Previous Screen"), 0, slotSwitchToPrevScreen);
DEF(kli18n("Kill Window"), Qt::CTRL | Qt::ALT | Qt::Key_Escape, slotKillWindow);
DEF(kli18n("Kill Window"), Qt::META | Qt::CTRL | Qt::Key_Escape, slotKillWindow);
DEF6(kli18n("Suspend Compositing"), Qt::SHIFT | Qt::ALT | Qt::Key_F12, Compositor::self(), Compositor::toggleCompositing);
DEF6(kli18n("Invert Screen Colors"), 0, kwinApp()->platform(), Platform::invertScreen);