@@ -3,6 +3,7 @@ Copyright 2016 Aviral Dasgupta
3
3
Copyright 2016 OpenMarket Ltd
4
4
Copyright 2019 Michael Telatynski <[email protected] >
5
5
Copyright 2018 - 2021 New Vector Ltd
6
+ Copyright 2022 Šimon Brandner <[email protected] >
6
7
7
8
Licensed under the Apache License, Version 2.0 (the "License");
8
9
you may not use this file except in compliance with the License.
@@ -34,10 +35,8 @@ import Modal from "matrix-react-sdk/src/Modal";
34
35
import InfoDialog from "matrix-react-sdk/src/components/views/dialogs/InfoDialog" ;
35
36
import Spinner from "matrix-react-sdk/src/components/views/elements/Spinner" ;
36
37
import {
37
- Categories ,
38
- CMD_OR_CTRL ,
38
+ CategoryName ,
39
39
DIGITS ,
40
- Modifiers ,
41
40
registerShortcut ,
42
41
} from "matrix-react-sdk/src/accessibility/KeyboardShortcuts" ;
43
42
import { isOnlyCtrlOrCmdKeyEvent , Key } from "matrix-react-sdk/src/Keyboard" ;
@@ -287,43 +286,50 @@ export default class ElectronPlatform extends VectorBasePlatform {
287
286
} ) ;
288
287
289
288
// 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 ,
293
292
key : DIGITS ,
294
- } ] ,
295
- description : _td ( "Switch to space by number" ) ,
293
+ } ,
294
+ displayName : _td ( "Switch to space by number" ) ,
296
295
} ) ;
297
296
298
297
if ( isMac ) {
299
- registerShortcut ( Categories . NAVIGATION , {
300
- keybinds : [ {
301
- modifiers : [ Modifiers . COMMAND ] ,
298
+ registerShortcut ( "KeyBinding.openUserSettings" , CategoryName . NAVIGATION , {
299
+ default : {
300
+ commandKey : true ,
302
301
key : Key . COMMA ,
303
- } ] ,
304
- description : _td ( "Open user settings" ) ,
302
+ } ,
303
+ displayName : _td ( "Open user settings" ) ,
305
304
} ) ;
306
-
307
- registerShortcut ( Categories . NAVIGATION , {
308
- keybinds : [ {
309
- modifiers : [ Modifiers . COMMAND ] ,
305
+ registerShortcut ( "KeyBinding.previousVisitedRoomOrCommunity" , CategoryName . NAVIGATION , {
306
+ default : {
307
+ commandKey : true ,
310
308
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 ,
313
315
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" ) ,
316
318
} ) ;
317
319
} else {
318
- registerShortcut ( Categories . NAVIGATION , {
319
- keybinds : [ {
320
- modifiers : [ Modifiers . ALT ] ,
320
+ registerShortcut ( "KeyBinding.previousVisitedRoomOrCommunity" , CategoryName . NAVIGATION , {
321
+ default : {
322
+ altKey : true ,
321
323
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 ,
324
330
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" ) ,
327
333
} ) ;
328
334
}
329
335
0 commit comments