@@ -427,7 +427,7 @@ window.focusShellTab = (number) => {
427
427
} ;
428
428
429
429
window . term [ number ] . onprocesschange = p => {
430
- document . getElementById ( "shell_tab" + number ) . innerText = `#${ number } - ${ p } ` ;
430
+ document . getElementById ( "shell_tab" + number ) . innerText = `#${ number + 1 } - ${ p } ` ;
431
431
} ;
432
432
433
433
document . getElementById ( "shell_tab" + number ) . innerText = "::" + port ;
@@ -441,13 +441,54 @@ window.focusShellTab = (number) => {
441
441
442
442
// Global keyboard shortcuts
443
443
const globalShortcut = electron . remote . globalShortcut ;
444
+ globalShortcut . unregisterAll ( ) ;
445
+
446
+ // Switch tabs
447
+ // Next
444
448
globalShortcut . register ( "CommandOrControl+Tab" , ( ) => {
445
- if ( window . currentTerm <= 3 ) {
449
+ console . log ( "next" ) ;
450
+ if ( window . term [ window . currentTerm + 1 ] ) {
446
451
window . focusShellTab ( window . currentTerm + 1 ) ;
452
+ } else if ( window . term [ window . currentTerm + 2 ] ) {
453
+ window . focusShellTab ( window . currentTerm + 2 ) ;
454
+ } else if ( window . term [ window . currentTerm + 3 ] ) {
455
+ window . focusShellTab ( window . currentTerm + 3 ) ;
456
+ } else if ( window . term [ window . currentTerm + 4 ] ) {
457
+ window . focusShellTab ( window . currentTerm + 4 ) ;
447
458
} else {
448
459
window . focusShellTab ( 0 ) ;
449
460
}
450
461
} ) ;
462
+ // Previous
463
+ globalShortcut . register ( "CommandOrControl+Shift+Tab" , ( ) => {
464
+ if ( window . term [ window . currentTerm - 1 ] ) {
465
+ window . focusShellTab ( window . currentTerm - 1 ) ;
466
+ } else if ( window . term [ window . currentTerm - 2 ] ) {
467
+ window . focusShellTab ( window . currentTerm - 2 ) ;
468
+ } else if ( window . term [ window . currentTerm - 3 ] ) {
469
+ window . focusShellTab ( window . currentTerm - 3 ) ;
470
+ } else if ( window . term [ window . currentTerm - 4 ] ) {
471
+ window . focusShellTab ( window . currentTerm - 4 ) ;
472
+ } else if ( window . term [ 4 ] ) {
473
+ window . focusShellTab ( 4 ) ;
474
+ }
475
+ } ) ;
476
+ // By tab number
477
+ globalShortcut . register ( "CommandOrControl+1" , ( ) => {
478
+ window . focusShellTab ( 0 ) ;
479
+ } ) ;
480
+ globalShortcut . register ( "CommandOrControl+2" , ( ) => {
481
+ window . focusShellTab ( 1 ) ;
482
+ } ) ;
483
+ globalShortcut . register ( "CommandOrControl+3" , ( ) => {
484
+ window . focusShellTab ( 2 ) ;
485
+ } ) ;
486
+ globalShortcut . register ( "CommandOrControl+4" , ( ) => {
487
+ window . focusShellTab ( 3 ) ;
488
+ } ) ;
489
+ globalShortcut . register ( "CommandOrControl+5" , ( ) => {
490
+ window . focusShellTab ( 4 ) ;
491
+ } ) ;
451
492
452
493
453
494
// Prevent showing menu, exiting fullscreen or app with keyboard shortcuts
0 commit comments