Merge pull request #247 from jgis/master
Force single app instance Close #236
This commit is contained in:
11
src/main.js
11
src/main.js
@@ -128,6 +128,17 @@ const trayImages = function() {
|
||||
}();
|
||||
var willAppQuit = false;
|
||||
|
||||
// If there is already an instance, activate the window in the existing instace and quit this one
|
||||
if (app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
else mainWindow.show();
|
||||
}
|
||||
})) {
|
||||
app.quit()
|
||||
}
|
||||
|
||||
function shouldShowTrayIcon() {
|
||||
if (process.platform === 'win32') {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user