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", "Dismiss": "Dismiss",
"Switch to space by number": "Switch to space by number", "Switch to space by number": "Switch to space by number",
"Open user settings": "Open user settings", "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)", "%(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", "Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
"Unknown device": "Unknown device", "Unknown device": "Unknown device",

View file

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