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, '../../');
23
23
var DEFAULT_URL = 'file://' + path . join ( RESOURCES , 'index.html#connect' ) ;
24
24
25
25
/**
26
- * We want want the Connect dialog window to be special
26
+ * We want the Connect dialog window to be special
27
27
* and for there to ever only be one instance of it
28
28
* so we'll use scope to essentially make it a Singleton.
29
29
*/
@@ -62,6 +62,23 @@ module.exports.create = function(opts) {
62
62
'direct-write' : true
63
63
}
64
64
} ) ;
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
+
65
82
attachMenu ( _window ) ;
66
83
_window . loadUrl ( opts . url ) ;
67
84
You can’t perform that action at this time.
0 commit comments