Skip to content

Commit 03e776d

Browse files
Improve the look of the keyboard settings tab (#20595)
* First cut of new keyboard shortcuts Signed-off-by: Šimon Brandner <[email protected]> * i18n Signed-off-by: Šimon Brandner <[email protected]>
1 parent 06fa4f4 commit 03e776d

File tree

2 files changed

+36
-29
lines changed

2 files changed

+36
-29
lines changed

src/i18n/strings/en_EN.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"Dismiss": "Dismiss",
1313
"Switch to space by number": "Switch to space by number",
1414
"Open user settings": "Open user settings",
15-
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
15+
"Previous recently visited room or community": "Previous recently visited room or community",
16+
"Next recently visited room or community": "Next recently visited room or community",
1617
"%(brand)s Desktop (%(platformName)s)": "%(brand)s Desktop (%(platformName)s)",
1718
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
1819
"Unknown device": "Unknown device",

src/vector/platform/ElectronPlatform.tsx

+34-28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Copyright 2016 Aviral Dasgupta
33
Copyright 2016 OpenMarket Ltd
44
Copyright 2019 Michael Telatynski <[email protected]>
55
Copyright 2018 - 2021 New Vector Ltd
6+
Copyright 2022 Šimon Brandner <[email protected]>
67
78
Licensed under the Apache License, Version 2.0 (the "License");
89
you may not use this file except in compliance with the License.
@@ -34,10 +35,8 @@ import Modal from "matrix-react-sdk/src/Modal";
3435
import InfoDialog from "matrix-react-sdk/src/components/views/dialogs/InfoDialog";
3536
import Spinner from "matrix-react-sdk/src/components/views/elements/Spinner";
3637
import {
37-
Categories,
38-
CMD_OR_CTRL,
38+
CategoryName,
3939
DIGITS,
40-
Modifiers,
4140
registerShortcut,
4241
} from "matrix-react-sdk/src/accessibility/KeyboardShortcuts";
4342
import { isOnlyCtrlOrCmdKeyEvent, Key } from "matrix-react-sdk/src/Keyboard";
@@ -287,43 +286,50 @@ export default class ElectronPlatform extends VectorBasePlatform {
287286
});
288287

289288
// register OS-specific shortcuts
290-
registerShortcut(Categories.NAVIGATION, {
291-
keybinds: [{
292-
modifiers: [CMD_OR_CTRL],
289+
registerShortcut("KeyBinding.switchToSpaceByNumber", CategoryName.NAVIGATION, {
290+
default: {
291+
ctrlOrCmdKey: true,
293292
key: DIGITS,
294-
}],
295-
description: _td("Switch to space by number"),
293+
},
294+
displayName: _td("Switch to space by number"),
296295
});
297296

298297
if (isMac) {
299-
registerShortcut(Categories.NAVIGATION, {
300-
keybinds: [{
301-
modifiers: [Modifiers.COMMAND],
298+
registerShortcut("KeyBinding.openUserSettings", CategoryName.NAVIGATION, {
299+
default: {
300+
commandKey: true,
302301
key: Key.COMMA,
303-
}],
304-
description: _td("Open user settings"),
302+
},
303+
displayName: _td("Open user settings"),
305304
});
306-
307-
registerShortcut(Categories.NAVIGATION, {
308-
keybinds: [{
309-
modifiers: [Modifiers.COMMAND],
305+
registerShortcut("KeyBinding.previousVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
306+
default: {
307+
commandKey: true,
310308
key: Key.SQUARE_BRACKET_LEFT,
311-
}, {
312-
modifiers: [Modifiers.COMMAND],
309+
},
310+
displayName: _td("Previous recently visited room or community"),
311+
});
312+
registerShortcut("KeyBinding.nextVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
313+
default: {
314+
commandKey: true,
313315
key: Key.SQUARE_BRACKET_RIGHT,
314-
}],
315-
description: _td("Previous/next recently visited room or community"),
316+
},
317+
displayName: _td("Next recently visited room or community"),
316318
});
317319
} else {
318-
registerShortcut(Categories.NAVIGATION, {
319-
keybinds: [{
320-
modifiers: [Modifiers.ALT],
320+
registerShortcut("KeyBinding.previousVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
321+
default: {
322+
altKey: true,
321323
key: Key.ARROW_LEFT,
322-
}, {
323-
modifiers: [Modifiers.ALT],
324+
},
325+
displayName: _td("Previous recently visited room or community"),
326+
});
327+
registerShortcut("KeyBinding.nextVisitedRoomOrCommunity", CategoryName.NAVIGATION, {
328+
default: {
329+
altKey: true,
324330
key: Key.ARROW_RIGHT,
325-
}],
326-
description: _td("Previous/next recently visited room or community"),
331+
},
332+
displayName: _td("Next recently visited room or community"),
327333
});
328334
}
329335

0 commit comments

Comments
 (0)