From e7e736ae26277012b9ac3d881f655cfd1a4f5885 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Tue, 27 Nov 2018 17:49:13 +0100 Subject: [PATCH] Handle squirrel events so we do windows installs properly --- src/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index ff90d03..435745e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,8 +33,6 @@ const createWindow = async () => { }); }; -app.on('ready', createWindow); - app.on('window-all-closed', () => { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q @@ -80,4 +78,12 @@ app.on('web-contents-created', (_event, contents) => { shell.openExternal(navigationUrl); } }); -}); \ No newline at end of file +}); + +if (require('electron-squirrel-startup')) { + // We've been opened as part of a Windows install. + // squirrel-startup handles all the hard work, we just need to not do anything. + app.quit(); +} else { + app.on('ready', createWindow); +} \ No newline at end of file