File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ var RESOURCES = path.resolve(__dirname, '../../');
2323var DEFAULT_URL = 'file://' + path . join ( RESOURCES , 'index.html#connect' ) ;
2424
2525/**
26- * We want want the Connect dialog window to be special
26+ * We want the Connect dialog window to be special
2727 * and for there to ever only be one instance of it
2828 * so we'll use scope to essentially make it a Singleton.
2929 */
@@ -62,6 +62,23 @@ module.exports.create = function(opts) {
6262 'direct-write' : true
6363 }
6464 } ) ;
65+
66+ // makes the application a single instance application
67+ // see "app.makeSingleInstance" in https://github.com/atom/electron/blob/master/docs/api/app.md
68+ var shouldQuit = app . makeSingleInstance ( function ( commandLine , workingDirectory ) {
69+ // Someone tried to run a second instance, we should focus our window
70+ if ( _window ) {
71+ if ( _window . isMinimized ( ) ) _window . restore ( ) ;
72+ _window . focus ( ) ;
73+ }
74+ return true ;
75+ } ) ;
76+
77+ if ( shouldQuit ) {
78+ app . quit ( ) ;
79+ return ;
80+ }
81+
6582 attachMenu ( _window ) ;
6683 _window . loadUrl ( opts . url ) ;
6784
You can’t perform that action at this time.
0 commit comments