Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/electron/window-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var RESOURCES = path.resolve(__dirname, '../../');
var DEFAULT_URL = 'file://' + path.join(RESOURCES, 'index.html#connect');

/**
* We want want the Connect dialog window to be special
* We want the Connect dialog window to be special
* and for there to ever only be one instance of it
* so we'll use scope to essentially make it a Singleton.
*/
Expand Down Expand Up @@ -62,6 +62,23 @@ module.exports.create = function(opts) {
'direct-write': true
}
});

// makes the application a single instance application
// see "app.makeSingleInstance" in https://github.com/atom/electron/blob/master/docs/api/app.md
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, we should focus our window
if (_window) {
if (_window.isMinimized()) _window.restore();
_window.focus();
}
return true;
});

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

attachMenu(_window);
_window.loadUrl(opts.url);

Expand Down