Change switch server implementation
Now uses the before-input-event instead of a globalShortcut. GH-512
This commit is contained in:
parent
eb5b760f70
commit
6dc396dec4
14
src/main.js
14
src/main.js
|
@ -8,8 +8,7 @@ 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');
|
||||||
|
@ -345,12 +344,15 @@ app.on('ready', () => {
|
||||||
|
|
||||||
// Add Alt+Cmd+(Right|Left) as alternative to switch between servers
|
// Add Alt+Cmd+(Right|Left) as alternative to switch between servers
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
globalShortcut.register('Alt+Cmd+Right', () => {
|
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||||
|
if (input.alt && input.meta) {
|
||||||
|
if (input.key === 'ArrowRight') {
|
||||||
mainWindow.webContents.send('select-next-tab');
|
mainWindow.webContents.send('select-next-tab');
|
||||||
});
|
}
|
||||||
|
if (input.key === 'ArrowLeft') {
|
||||||
globalShortcut.register('Alt+Cmd+Left', () => {
|
|
||||||
mainWindow.webContents.send('select-previous-tab');
|
mainWindow.webContents.send('select-previous-tab');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue