From 4bc5b1d6083322b6bbd6e363fe2fda3cae1d8a79 Mon Sep 17 00:00:00 2001 From: Preston Date: Sun, 21 Jun 2020 23:03:51 -0400 Subject: [PATCH] Allow more than one instance of the app. --- src/main/index.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index aae38455..9ea3a1e1 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -14,7 +14,7 @@ app.setName(productName) // disable electron warning process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true' -const gotTheLock = app.requestSingleInstanceLock() +// const gotTheLock = app.requestSingleInstanceLock() const isDev = process.env.NODE_ENV === 'development' const isDebug = process.argv.includes('--debug') let mainWindow @@ -24,25 +24,26 @@ let mainWindow // This line can possible be removed if the issue is fixed upstream app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors') +// TODO: Uncomment if needed // only allow single instance of application -if (!isDev) { - if (gotTheLock) { - app.on('second-instance', () => { - // Someone tried to run a second instance, we should focus our window. - if (mainWindow && mainWindow.isMinimized()) { - mainWindow.restore() - } - mainWindow.focus() - }) - } else { - app.quit() - process.exit(0) - } -} else { - require('electron-debug')({ - showDevTools: !(process.env.RENDERER_REMOTE_DEBUGGING === 'true') - }) -} +// if (!isDev) { +// if (gotTheLock) { +// app.on('second-instance', () => { +// // Someone tried to run a second instance, we should focus our window. +// if (mainWindow && mainWindow.isMinimized()) { +// mainWindow.restore() +// } +// mainWindow.focus() +// }) +// } else { +// app.quit() +// process.exit(0) +// } +// } else { +// require('electron-debug')({ +// showDevTools: !(process.env.RENDERER_REMOTE_DEBUGGING === 'true') +// }) +// } async function installDevTools () { try { @@ -70,7 +71,6 @@ function createWindow () { webSecurity: false, backgroundThrottling: false }, - show: false }) // eslint-disable-next-line