Merge pull request #612 from wvds/GH-512

Add Ctrl(+Shift)+Tab as alternative to switch between servers
This commit is contained in:
Yuya Ochiai
2017-10-12 23:08:20 +09:00
committed by GitHub
2 changed files with 17 additions and 2 deletions

View File

@@ -114,6 +114,21 @@ function createMainWindow(config, options) {
mainWindow.webContents.send('focus-on-webview'); mainWindow.webContents.send('focus-on-webview');
}); });
// Register keyboard shortcuts
mainWindow.webContents.on('before-input-event', (event, input) => {
// Add Alt+Cmd+(Right|Left) as alternative to switch between servers
if (process.platform === 'darwin') {
if (input.alt && input.meta) {
if (input.key === 'ArrowRight') {
mainWindow.webContents.send('select-next-tab');
}
if (input.key === 'ArrowLeft') {
mainWindow.webContents.send('select-previous-tab');
}
}
}
});
return mainWindow; return mainWindow;
} }

View File

@@ -187,14 +187,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');
}, },