File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,22 @@ var al = new AudioLibrary(libraryPersist.store)
3535module . exports = state
3636module . exports . al = al
3737
38+ var shouldQuit = app . makeSingleInstance ( function ( commandLine , workingDirectory ) {
39+ // https://github.com/electron/electron/blob/v0.36.10/docs/api/app.md#appmakesingleinstancecallback
40+ // Someone tried to run a second instance, we should focus our window.
41+ if ( player . win ) {
42+ if ( player . win . isMinimized ( ) ) player . win . restore ( )
43+ player . win . focus ( )
44+ } else {
45+ al . recall ( )
46+ player . init ( )
47+ }
48+ } )
49+
50+ if ( shouldQuit ) {
51+ app . exit ( )
52+ }
53+
3854app . on ( 'ready' , function appReady ( ) {
3955 menu . init ( )
4056 audio . init ( )
@@ -216,7 +232,7 @@ app.on('ready', function appReady () {
216232 autoUpdater . checkForUpdatesAndNotify ( )
217233 } , 500 )
218234
219- if ( process . platform !== 'darwin' ) {
235+ if ( process . platform !== 'darwin' ) { // TODO System tray on windows (maybe linux)
220236 // since window-all-closed doesn't fire with our hidden audio process
221237 player . win . once ( 'closed' , ( ) => {
222238 app . quit ( )
You can’t perform that action at this time.
0 commit comments