diff options
| -rw-r--r-- | electron_js/main.js | 24 | ||||
| -rwxr-xr-x | prepare_desktop.sh | 4 |
2 files changed, 15 insertions, 13 deletions
diff --git a/electron_js/main.js b/electron_js/main.js index 1236ae11..95e1521b 100644 --- a/electron_js/main.js +++ b/electron_js/main.js @@ -29,19 +29,21 @@ if (argv.path) { let win; app.commandLine.appendSwitch ('ignore-certificate-errors', 'true'); -const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { - // Someone tried to run a second instance, we should focus our window. - if (win) { - if (win.isMinimized()) win.restore(); - win.focus(); - } -}); - -if (shouldQuit) { - app.quit(); - return; +const gotTheLock = app.requestSingleInstanceLock() + +if (!gotTheLock) { + app.quit() +} else { + app.on('second-instance', (event, commandLine, workingDirectory) => { + // Someone tried to run a second instance, we should focus our window. + if (myWindow) { + if (myWindow.isMinimized()) myWindow.restore() + myWindow.focus() + } + }) } + function newWindow() { createAlternateWindow(); } diff --git a/prepare_desktop.sh b/prepare_desktop.sh index cc633add..88fb9b47 100755 --- a/prepare_desktop.sh +++ b/prepare_desktop.sh @@ -1,7 +1,7 @@ #!/bin/bash -REL="v3.0.11" -#REL="v1.4.3" +REL="v4.0.0" +#REL="v3.0.11" WGET='wget' WGET_ARGS='-q --show-progress' UNZIP='unzip' |
