File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -5,24 +5,23 @@ const ipc = electron.ipcMain
5
5
const GhReleases = require ( 'electron-gh-releases' )
6
6
const { isPackaged } = app
7
7
// electron.crashReporter.start()
8
+ const singleInstance = app . requestSingleInstanceLock ( )
8
9
9
10
var ipcServer = null
10
11
11
12
var mainWindow = null
12
13
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 ) {
25
16
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
+ } )
26
25
}
27
26
28
27
var isUpdateReady = false
You can’t perform that action at this time.
0 commit comments