Browse Source

Fix Cmd+number tab changing in MacOs

pull/2453/head
Vulich Fernando 6 years ago
parent
commit
8992c2cdda
  1. 5
      app.js
  2. 11
      app/Application.js
  3. 11
      electron/main.js

5
app.js

@ -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
app/Application.js

@ -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

11
electron/main.js

@ -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
@ -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.

Loading…
Cancel
Save