@@ -218,7 +218,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
218218 this . startUpdateCheck = this . startUpdateCheck . bind ( this ) ;
219219 this . stopUpdateCheck = this . stopUpdateCheck . bind ( this ) ;
220220
221- // register Mac specific shortcuts
221+ // register OS- specific shortcuts
222222 if ( isMac ) {
223223 registerShortcut ( Categories . NAVIGATION , {
224224 keybinds : [ {
@@ -227,6 +227,28 @@ export default class ElectronPlatform extends VectorBasePlatform {
227227 } ] ,
228228 description : _td ( "Open user settings" ) ,
229229 } ) ;
230+
231+ registerShortcut ( Categories . NAVIGATION , {
232+ keybinds : [ {
233+ modifiers : [ Modifiers . COMMAND ] ,
234+ key : Key . SQUARE_BRACKET_LEFT ,
235+ } , {
236+ modifiers : [ Modifiers . COMMAND ] ,
237+ key : Key . SQUARE_BRACKET_RIGHT ,
238+ } ] ,
239+ description : _td ( "Previous/next recently visited room or community" ) ,
240+ } ) ;
241+ } else {
242+ registerShortcut ( Categories . NAVIGATION , {
243+ keybinds : [ {
244+ modifiers : [ Modifiers . ALT ] ,
245+ key : Key . ARROW_LEFT ,
246+ } , {
247+ modifiers : [ Modifiers . ALT ] ,
248+ key : Key . ARROW_RIGHT ,
249+ } ] ,
250+ description : _td ( "Previous/next recently visited room or community" ) ,
251+ } ) ;
230252 }
231253 }
232254
@@ -434,4 +456,32 @@ export default class ElectronPlatform extends VectorBasePlatform {
434456 description : < Spinner /> ,
435457 } ) ;
436458 }
459+
460+ _navigateForwardBack ( back : boolean ) {
461+ this . _ipcCall ( back ? "navigateBack" : "navigateForward" ) ;
462+ }
463+
464+ onKeyDown ( ev : KeyboardEvent ) : boolean {
465+ let handled = false ;
466+
467+ switch ( ev . key ) {
468+ case Key . SQUARE_BRACKET_LEFT :
469+ case Key . SQUARE_BRACKET_RIGHT :
470+ if ( isMac && ev . metaKey && ! ev . altKey && ! ev . ctrlKey && ! ev . shiftKey ) {
471+ this . _navigateForwardBack ( ev . key === Key . SQUARE_BRACKET_LEFT ) ;
472+ handled = true ;
473+ }
474+ break ;
475+
476+ case Key . ARROW_LEFT :
477+ case Key . ARROW_RIGHT :
478+ if ( ! isMac && ev . altKey && ! ev . metaKey && ! ev . ctrlKey && ! ev . shiftKey ) {
479+ this . _navigateForwardBack ( ev . key === Key . ARROW_LEFT ) ;
480+ handled = true ;
481+ }
482+ break ;
483+ }
484+
485+ return handled ;
486+ }
437487}
0 commit comments