From 2697d61ab1450878aa0c56e6c49c619006aa64bf Mon Sep 17 00:00:00 2001 From: Keith Maika Date: Mon, 28 Mar 2022 22:03:20 -0400 Subject: [PATCH] Prevent a second instance. --- main.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.js b/main.js index 8c9d5d3..c3965bb 100644 --- a/main.js +++ b/main.js @@ -15,6 +15,10 @@ const isMac = process.platform === 'darwin' const isWin = process.platform === 'win32' function initApp() { + if (!app.requestSingleInstanceLock()) { + app.quit(); + } + createWindow() // Set Windows platform notifications if (isWin) { @@ -120,6 +124,10 @@ app.on('activate', function () { } }) +app.on('second-instance', function () { + mainWindow.show(); +}); + // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here.