diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-05-02 11:44:29 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-05-02 11:44:29 +0100 |
| commit | 1b514f646bbb1bb73ae8e4db3365d9c1cc5b4b9e (patch) | |
| tree | f487e8eeb45ccfca88b5f49f1ea874bdad63498e /app | |
| parent | 14ca7504904bef8b5148ca710325e69ef6608e5c (diff) | |
| parent | a172ee6219098f7417d15d38a47ae90b8b374560 (diff) | |
| download | mullvadvpn-1b514f646bbb1bb73ae8e4db3365d9c1cc5b4b9e.tar.xz mullvadvpn-1b514f646bbb1bb73ae8e4db3365d9c1cc5b4b9e.zip | |
Merge branch 'feature-singleton-frontend'
Diffstat (limited to 'app')
| -rw-r--r-- | app/main.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/main.js b/app/main.js index dc3b5f4c86..1321f05219 100644 --- a/app/main.js +++ b/app/main.js @@ -555,4 +555,22 @@ const appDelegate = { }; +try { + // This callback is guaranteed to be excuted after 'ready' events have been + // sent to the app. + const notFirstInstance = app.makeSingleInstance((_args, _workingDirectory) => { + log.debug('Another instance was spawned, showing window'); + const window = appDelegate._window; + if (window != null) { + appDelegate._showWindow(window, appDelegate._tray); + } + }); + + if (notFirstInstance) { + log.info('Another instance already exists, shutting down'); + app.exit(); + } +} catch (e) { + log.error('Failed to check if another instance is running: ', e); +} appDelegate.setup(); |
