Improve the look of the keyboard settings tab (#20595)

* First cut of new keyboard shortcuts

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* i18n

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2022-01-24 12:33:37 +01:00 committed by GitHub
parent 06fa4f4440
commit 03e776d9c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 29 deletions

View file

@ -12,7 +12,8 @@
"Dismiss": "Dismiss",
"Switch to space by number": "Switch to space by number",
"Open user settings": "Open user settings",
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
"Previous recently visited room or community": "Previous recently visited room or community",
"Next recently visited room or community": "Next recently visited room or community",
"%(brand)s Desktop (%(platformName)s)": "%(brand)s Desktop (%(platformName)s)",
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
"Unknown device": "Unknown device",

View file

@ -3,6 +3,7 @@ Copyright 2016 Aviral Dasgupta
Copyright 2016 OpenMarket Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Copyright 2018 - 2021 New Vector Ltd
Copyright 2022 Šimon Brandner <simon.bra.ag@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -34,10 +35,8 @@ import Modal from "matrix-react-sdk/src/Modal";
import InfoDialog from "matrix-react-sdk/src/components/views/dialogs/InfoDialog";
import Spinner from "matrix-react-sdk/src/components/views/elements/Spinner";
import {
Categories,
CMD_OR_CTRL,
CategoryName,
DIGITS,
Modifiers,
registerShortcut,
} from "matrix-react-sdk/src/accessibility/KeyboardShortcuts";
import { isOnlyCtrlOrCmdKeyEvent, Key } from "matrix-react-sdk/src/Keyboard";
@ -287,43 +286,50 @@ export default class ElectronPlatform extends VectorBasePlatform {
});
// register OS-specific shortcuts
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
modifiers: [CMD_OR_CTRL],
registerShortcut("KeyBinding.switchToSpaceByNumber", CategoryName.NAVIGATION, {
default: {
ctrlOrCmdKey: true,
key: DIGITS,
}],
description: _td("Switch to space by number"),
},
displayName: _td("Switch to space by number"),
});
if (isMac) {
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
modifiers: [Modifiers.COMMAND],
registerShortcut("KeyBinding.openUserSettings", CategoryName.NAVIGATION, {
default: {
commandKey: true,
key: Key.COMMA,
}],
description: _td("Open user settings"),
},
displayName: _td("Open user settings"),
});
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
modifiers: [Modifiers.COMMAND],
registerShortcut("KeyBinding.previousVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
default: {
commandKey: true,
key: Key.SQUARE_BRACKET_LEFT,
}, {
modifiers: [Modifiers.COMMAND],
},
displayName: _td("Previous recently visited room or community"),
});
registerShortcut("KeyBinding.nextVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
default: {
commandKey: true,
key: Key.SQUARE_BRACKET_RIGHT,
}],
description: _td("Previous/next recently visited room or community"),
},
displayName: _td("Next recently visited room or community"),
});
} else {
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
modifiers: [Modifiers.ALT],
registerShortcut("KeyBinding.previousVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
default: {
altKey: true,
key: Key.ARROW_LEFT,
}, {
modifiers: [Modifiers.ALT],
},
displayName: _td("Previous recently visited room or community"),
});
registerShortcut("KeyBinding.nextVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
default: {
altKey: true,
key: Key.ARROW_RIGHT,
}],
description: _td("Previous/next recently visited room or community"),
},
displayName: _td("Next recently visited room or community"),
});
}