summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gui/packages/desktop/src/main/index.js25
1 files changed, 10 insertions, 15 deletions
diff --git a/gui/packages/desktop/src/main/index.js b/gui/packages/desktop/src/main/index.js
index 22e3af217c..3b9a04d7f8 100644
--- a/gui/packages/desktop/src/main/index.js
+++ b/gui/packages/desktop/src/main/index.js
@@ -46,22 +46,17 @@ const ApplicationMain = {
},
_ensureSingleInstance() {
- // This callback is guaranteed to be excuted after 'ready' events have been
- // sent to the app.
- const shouldQuit = app.makeSingleInstance((_args, _workingDirectory) => {
- log.debug('Another instance was spawned, showing window');
-
- if (this._windowController) {
- this._windowController.show();
- }
- });
-
- if (shouldQuit) {
- log.info('Another instance already exists, shutting down');
- app.exit();
+ if (app.requestSingleInstanceLock()) {
+ app.on('second-instance', (event, commandLine, workingDirectory) => {
+ if (this._windowController) {
+ this._windowController.show();
+ }
+ });
+ return false;
+ } else {
+ app.quit();
+ return true;
}
-
- return shouldQuit;
},
_overrideAppPaths() {