Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
prevent multiple instance of the app
Browse files Browse the repository at this point in the history
  • Loading branch information
krydos committed Apr 23, 2018
1 parent 154f4dd commit 4fee63c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ function createWindow () {
});
}

// make sure we run only one instance of the app
var win = null;

var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, we should focus our window.
if (win) {
if (win.isMinimized()) win.restore();
win.focus();
}
});

if (shouldQuit) {
app.quit();
return;
}

app.on('ready', createWindow);

app.commandLine.appendSwitch('high-dpi-support', 1);
app.commandLine.appendSwitch('force-device-scale-factor', 1);

0 comments on commit 4fee63c

Please sign in to comment.