Prevent a second instance.
This commit is contained in:
parent
5aad0dfe34
commit
95bcc1a6b4
8
main.js
8
main.js
|
@ -15,6 +15,10 @@ const isMac = process.platform === 'darwin'
|
||||||
const isWin = process.platform === 'win32'
|
const isWin = process.platform === 'win32'
|
||||||
|
|
||||||
function initApp() {
|
function initApp() {
|
||||||
|
if (!app.requestSingleInstanceLock()) {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
|
||||||
createWindow()
|
createWindow()
|
||||||
// Set Windows platform notifications
|
// Set Windows platform notifications
|
||||||
if (isWin) {
|
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
|
// 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.
|
// code. You can also put them in separate files and require them here.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue