From c50d17e82b7fd337d4037ddf646cd1a8fc765bae Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Mon, 15 Aug 2022 18:13:53 +0200 Subject: [PATCH] fix: startup exception --- src/main/main.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index 07963fde..744e7167 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -130,6 +130,24 @@ else { if (isDevelopment) mainWindow.webContents.openDevTools(); + app.on('browser-window-focus', () => { + // Send registered shortcut events to window + shortCutRegister.init(); + + if (isDevelopment) { // Dev shortcuts + globalShortcut.register('Shift+CommandOrControl+F5', () => { + mainWindow.reload(); + }); + globalShortcut.register('Shift+CommandOrControl+F12', () => { + mainWindow.webContents.openDevTools(); + }); + } + }); + + app.on('browser-window-blur', () => { + shortCutRegister.unregister(); + }); + process.on('uncaughtException', error => { mainWindow.webContents.send('unhandled-exception', error); }); @@ -146,24 +164,6 @@ else { window.webContents.session.loadExtension(extensionPath, { allowFileAccess: true }).catch(console.error); } }); - - app.on('browser-window-focus', () => { - // Send registered shortcut events to window - shortCutRegister.init(); - - if (isDevelopment) { // Dev shortcuts - globalShortcut.register('Shift+CommandOrControl+F5', () => { - mainWindow.reload(); - }); - globalShortcut.register('Shift+CommandOrControl+F12', () => { - mainWindow.webContents.openDevTools(); - }); - } - }); - - app.on('browser-window-blur', () => { - shortCutRegister.unregister(); - }); } function createAppMenu () {