File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,24 +5,23 @@ const ipc = electron.ipcMain
55const GhReleases = require ( 'electron-gh-releases' )
66const { isPackaged } = app
77// electron.crashReporter.start()
8+ const singleInstance = app . requestSingleInstanceLock ( )
89
910var ipcServer = null
1011
1112var mainWindow = null
1213
13- var shouldQuit = app . makeSingleInstance ( function ( commandLine , workingDirectory ) {
14- if ( mainWindow ) {
15- if ( process . platform === 'win32' ) {
16- mainWindow . minimize ( )
17- mainWindow . restore ( )
18- }
19- mainWindow . focus ( )
20- }
21- return true
22- } )
23-
24- if ( shouldQuit ) {
14+ // Single Instance Lock
15+ if ( ! singleInstance ) {
2516 app . quit ( )
17+ } else {
18+ app . on ( 'second-instance' , ( ) => {
19+ // Someone tried to run a second instance, it should focus the existing instance.
20+ if ( mainWindow ) {
21+ if ( ! mainWindow . isVisible ( ) ) mainWindow . show ( )
22+ mainWindow . focus ( )
23+ }
24+ } )
2625}
2726
2827var isUpdateReady = false
You can’t perform that action at this time.
0 commit comments