Add Ctrl(+Shift)+Tab as alternative to switch between servers

Closes #512
This commit is contained in:
Wesley van der Sanden
2017-10-07 17:12:03 +02:00
parent 85a1b34081
commit eb5b760f70
2 changed files with 15 additions and 3 deletions

View File

@@ -8,7 +8,8 @@ const {
nativeImage, nativeImage,
dialog, dialog,
systemPreferences, systemPreferences,
session session,
globalShortcut
} = require('electron'); } = require('electron');
const isDev = require('electron-is-dev'); const isDev = require('electron-is-dev');
const installExtension = require('electron-devtools-installer'); const installExtension = require('electron-devtools-installer');
@@ -342,6 +343,17 @@ app.on('ready', () => {
console.log('The application has crashed.'); console.log('The application has crashed.');
}); });
// Add Alt+Cmd+(Right|Left) as alternative to switch between servers
if (process.platform === 'darwin') {
globalShortcut.register('Alt+Cmd+Right', () => {
mainWindow.webContents.send('select-next-tab');
});
globalShortcut.register('Alt+Cmd+Left', () => {
mainWindow.webContents.send('select-previous-tab');
});
}
ipcMain.on('notified', () => { ipcMain.on('notified', () => {
if (process.platform === 'win32' || process.platform === 'linux') { if (process.platform === 'win32' || process.platform === 'linux') {
if (config.notifications.flashWindow === 2) { if (config.notifications.flashWindow === 2) {

View File

@@ -186,14 +186,14 @@ function createTemplate(mainWindow, config, isDev) {
}; };
}), separatorItem, { }), separatorItem, {
label: 'Select Next Server', label: 'Select Next Server',
accelerator: (process.platform === 'darwin') ? 'Alt+Cmd+Right' : 'CmdOrCtrl+Tab', accelerator: 'Ctrl+Tab',
click() { click() {
mainWindow.webContents.send('select-next-tab'); mainWindow.webContents.send('select-next-tab');
}, },
enabled: (config.teams.length > 1) enabled: (config.teams.length > 1)
}, { }, {
label: 'Select Previous Server', label: 'Select Previous Server',
accelerator: (process.platform === 'darwin') ? 'Alt+Cmd+Left' : 'CmdOrCtrl+Shift+Tab', accelerator: 'Ctrl+Shift+Tab',
click() { click() {
mainWindow.webContents.send('select-previous-tab'); mainWindow.webContents.send('select-previous-tab');
}, },