How to prevent multiple instances in Electron
There is a new API now: requestSingleInstanceLock const { app } = require(‘electron’) let myWindow = null const gotTheLock = app.requestSingleInstanceLock() if (!gotTheLock) { app.quit() } else { app.on(‘second-instance’, (event, commandLine, workingDirectory) => { // Someone tried to run a second instance, we should focus our window. if (myWindow) { if (myWindow.isMinimized()) myWindow.restore() myWindow.focus() } … Read more