Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Commit

Permalink
Fix Cmd+number tab changing in MacOs
Browse files Browse the repository at this point in the history
  • Loading branch information
fvulich committed Nov 15, 2019
1 parent 1f5f966 commit 8992c2c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 5 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,8 @@ ipc.on('zoomout-webview', function() {

tabPanel.getActiveTab().zoomOut();
});
ipc.on('shortcut:tab', function(e, arg) {
var tabPanel = Ext.cq1('app-main');
if ( arg >= tabPanel.items.indexOf(Ext.getCmp('tbfill')) ) arg++;
tabPanel.setActiveTab(arg);
});
11 changes: 0 additions & 11 deletions app/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,6 @@ Ext.define('Rambox.Application', {
tabPanel.getActiveTab().resetZoom();
}
}
,{
key: "123456789"
,ctrl: true
,alt: false
,handler: function(key) {
var tabPanel = Ext.cq1('app-main');
key = key - 48;
if ( key >= tabPanel.items.indexOf(Ext.getCmp('tbfill')) ) key++;
tabPanel.setActiveTab(key);
}
}
,{
key: 188 // comma
,ctrl: true
Expand Down
11 changes: 10 additions & 1 deletion electron/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const {app, protocol, BrowserWindow, dialog, shell, Menu, ipcMain, nativeImage, session} = require('electron');
const {app, protocol, BrowserWindow, dialog, shell, Menu, ipcMain, nativeImage, session, globalShortcut} = require('electron');
// Tray
const tray = require('./tray');
// AutoLaunch
Expand Down Expand Up @@ -476,6 +476,15 @@ if ( config.get('disable_gpu') ) app.disableHardwareAcceleration();
// initialization and is ready to create browser windows.
app.on('ready', function() {
config.get('master_password') ? createMasterPasswordWindow() : createWindow();
globalShortcut.register('CommandOrControl+1', () => { mainWindow.webContents.send('shortcut:tab', 1); })
globalShortcut.register('CommandOrControl+2', () => { mainWindow.webContents.send('shortcut:tab', 2); })
globalShortcut.register('CommandOrControl+3', () => { mainWindow.webContents.send('shortcut:tab', 3); })
globalShortcut.register('CommandOrControl+4', () => { mainWindow.webContents.send('shortcut:tab', 4); })
globalShortcut.register('CommandOrControl+5', () => { mainWindow.webContents.send('shortcut:tab', 5); })
globalShortcut.register('CommandOrControl+6', () => { mainWindow.webContents.send('shortcut:tab', 6); })
globalShortcut.register('CommandOrControl+7', () => { mainWindow.webContents.send('shortcut:tab', 7); })
globalShortcut.register('CommandOrControl+8', () => { mainWindow.webContents.send('shortcut:tab', 8); })
globalShortcut.register('CommandOrControl+9', () => { mainWindow.webContents.send('shortcut:tab', 9); })
});

// Quit when all windows are closed.
Expand Down

2 comments on commit 8992c2c

@ludorumjeoun
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global shortcuts are work even in background.

#2446 #2447

@Kovah
Copy link

@Kovah Kovah commented on 8992c2c Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on breaking Rambox.

Please sign in to comment.