mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Fix register/unregister of globalshortcuts
This commit is contained in:
parent
7abf2531c8
commit
a1087f1912
@ -633,8 +633,13 @@ export class WindowHandler {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register global shortcuts
|
app.on('browser-window-focus', () => {
|
||||||
this.registerGlobalShortcuts();
|
this.registerGlobalShortcuts();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('browser-window-blur', () => {
|
||||||
|
this.unregisterGlobalShortcuts();
|
||||||
|
});
|
||||||
|
|
||||||
// Validate window navigation
|
// Validate window navigation
|
||||||
preventWindowNavigation(this.mainWindow, false);
|
preventWindowNavigation(this.mainWindow, false);
|
||||||
@ -1822,7 +1827,7 @@ export class WindowHandler {
|
|||||||
* Registers keyboard shortcuts or devtools
|
* Registers keyboard shortcuts or devtools
|
||||||
*/
|
*/
|
||||||
private registerGlobalShortcuts(): void {
|
private registerGlobalShortcuts(): void {
|
||||||
logger.info(`window-handler: registering global shortcuts!`);
|
logger.info('window-handler: register global shortcuts!');
|
||||||
globalShortcut.register(
|
globalShortcut.register(
|
||||||
isMac ? 'Cmd+Alt+I' : 'Ctrl+Shift+I',
|
isMac ? 'Cmd+Alt+I' : 'Ctrl+Shift+I',
|
||||||
this.onRegisterDevtools,
|
this.onRegisterDevtools,
|
||||||
@ -1840,8 +1845,6 @@ export class WindowHandler {
|
|||||||
globalShortcut.register(isMac ? 'Cmd+Alt+3' : 'Ctrl+Shift+3', () =>
|
globalShortcut.register(isMac ? 'Cmd+Alt+3' : 'Ctrl+Shift+3', () =>
|
||||||
this.switchClient(ClientSwitchType.CLIENT_2_0_DAILY),
|
this.switchClient(ClientSwitchType.CLIENT_2_0_DAILY),
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
logger.info('Switch between clients not supported for this POD-url');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
@ -1854,59 +1857,32 @@ export class WindowHandler {
|
|||||||
globalShortcut.register('Ctrl+=', zoomIn);
|
globalShortcut.register('Ctrl+=', zoomIn);
|
||||||
globalShortcut.register('Ctrl+-', zoomOut);
|
globalShortcut.register('Ctrl+-', zoomOut);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.on('browser-window-focus', () => {
|
/**
|
||||||
globalShortcut.register(
|
* Registers keyboard shortcuts or devtools
|
||||||
isMac ? 'Cmd+Alt+I' : 'Ctrl+Shift+I',
|
*/
|
||||||
this.onRegisterDevtools,
|
private unregisterGlobalShortcuts(): void {
|
||||||
);
|
logger.info('window-handler: unregister global shortcuts!');
|
||||||
globalShortcut.register('CmdOrCtrl+R', this.onReload);
|
|
||||||
if (isMac) {
|
|
||||||
globalShortcut.register('CmdOrCtrl+Plus', zoomIn);
|
|
||||||
globalShortcut.register('CmdOrCtrl+=', zoomIn);
|
|
||||||
if (this.isMana) {
|
|
||||||
globalShortcut.register('CmdOrCtrl+-', zoomOut);
|
|
||||||
}
|
|
||||||
} else if (this.isMana && (isWindowsOS || isLinux)) {
|
|
||||||
globalShortcut.register('Ctrl+=', zoomIn);
|
|
||||||
globalShortcut.register('Ctrl+-', zoomOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.url && this.url.startsWith('https://corporate.symphony.com')) {
|
globalShortcut.unregister(isMac ? 'Cmd+Alt+I' : 'Ctrl+Shift+I');
|
||||||
globalShortcut.register(isMac ? 'Cmd+Alt+1' : 'Ctrl+Shift+1', () =>
|
globalShortcut.unregister('CmdOrCtrl+R');
|
||||||
this.switchClient(ClientSwitchType.CLIENT_1_5),
|
if (isMac) {
|
||||||
);
|
globalShortcut.unregister('CmdOrCtrl+Plus');
|
||||||
globalShortcut.register(isMac ? 'Cmd+Alt+2' : 'Ctrl+Shift+2', () =>
|
globalShortcut.unregister('CmdOrCtrl+=');
|
||||||
this.switchClient(ClientSwitchType.CLIENT_2_0),
|
if (this.isMana) {
|
||||||
);
|
globalShortcut.unregister('CmdOrCtrl+-');
|
||||||
globalShortcut.register(isMac ? 'Cmd+Alt+3' : 'Ctrl+Shift+3', () =>
|
|
||||||
this.switchClient(ClientSwitchType.CLIENT_2_0_DAILY),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
logger.info('Switch between clients not supported for this POD-url');
|
|
||||||
}
|
}
|
||||||
});
|
} else if (this.isMana && (isWindowsOS || isLinux)) {
|
||||||
|
globalShortcut.unregister('Ctrl+=');
|
||||||
app.on('browser-window-blur', () => {
|
globalShortcut.unregister('Ctrl+-');
|
||||||
globalShortcut.unregister(isMac ? 'Cmd+Alt+I' : 'Ctrl+Shift+I');
|
}
|
||||||
globalShortcut.unregister('CmdOrCtrl+R');
|
// Unregister shortcuts related to client switch
|
||||||
if (isMac) {
|
if (this.url && this.url.startsWith('https://corporate.symphony.com')) {
|
||||||
globalShortcut.unregister('CmdOrCtrl+Plus');
|
globalShortcut.unregister(isMac ? 'Cmd+Alt+1' : 'Ctrl+Shift+1');
|
||||||
globalShortcut.unregister('CmdOrCtrl+=');
|
globalShortcut.unregister(isMac ? 'Cmd+Alt+2' : 'Ctrl+Shift+2');
|
||||||
if (this.isMana) {
|
globalShortcut.unregister(isMac ? 'Cmd+Alt+3' : 'Ctrl+Shift+3');
|
||||||
globalShortcut.unregister('CmdOrCtrl+-');
|
}
|
||||||
}
|
|
||||||
} else if (this.isMana && (isWindowsOS || isLinux)) {
|
|
||||||
globalShortcut.unregister('Ctrl+=');
|
|
||||||
globalShortcut.unregister('Ctrl+-');
|
|
||||||
}
|
|
||||||
// Unregister shortcuts related to client switch
|
|
||||||
if (this.url && this.url.startsWith('https://corporate.symphony.com')) {
|
|
||||||
globalShortcut.unregister(isMac ? 'Cmd+Alt+1' : 'Ctrl+Shift+1');
|
|
||||||
globalShortcut.unregister(isMac ? 'Cmd+Alt+2' : 'Ctrl+Shift+2');
|
|
||||||
globalShortcut.unregister(isMac ? 'Cmd+Alt+3' : 'Ctrl+Shift+3');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user