1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

Single Instance fix #3241

Fixes single instance depreciation
This commit is contained in:
jhdcruz
2019-09-05 22:15:41 +08:00
committed by Junyoung Choi
parent 59f8425c97
commit 3c0f20f364

View File

@@ -5,24 +5,23 @@ const ipc = electron.ipcMain
const GhReleases = require('electron-gh-releases')
const { isPackaged } = app
// electron.crashReporter.start()
const singleInstance = app.requestSingleInstanceLock()
var ipcServer = null
var mainWindow = null
var shouldQuit = app.makeSingleInstance(function (commandLine, workingDirectory) {
if (mainWindow) {
if (process.platform === 'win32') {
mainWindow.minimize()
mainWindow.restore()
}
mainWindow.focus()
}
return true
})
if (shouldQuit) {
// Single Instance Lock
if (!singleInstance) {
app.quit()
} else {
app.on('second-instance', () => {
// Someone tried to run a second instance, it should focus the existing instance.
if (mainWindow) {
if (!mainWindow.isVisible()) mainWindow.show()
mainWindow.focus()
}
})
}
var isUpdateReady = false