From 746d8a487305bf8a54544ae1658852ce856e6400 Mon Sep 17 00:00:00 2001 From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com> Date: Fri, 30 Dec 2022 15:02:58 +0100 Subject: [PATCH] UI shortcut on desktop restore app from tray if the app is already running --- electron.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/electron.js b/electron.js index a11997ee..c71ec9b6 100644 --- a/electron.js +++ b/electron.js @@ -120,9 +120,16 @@ const isLock = app.requestSingleInstanceLock() if (!isLock) { app.quit() } else { + app.on('second-instance', (event, commandLine, workingDirectory) => { + if (myWindow) { + if (myWindow.isMinimized()) + myWindow.maximize() + myWindow.show() + } + }) app.whenReady().then(() => { - createWindow(); - createTray(); + createWindow() + createTray() if (process.platform === 'win32') { app.setAppUserModelId("org.qortal.QortalUI") } @@ -143,7 +150,7 @@ if (!isLock) { } }) ipcMain.on('app_version', (event) => { - log.info(app.getVersion()); + log.info(app.getVersion()) mainWindow.webContents.send('app_version', { version: app.getVersion() }) }) autoUpdater.on('update-available', (event) => { @@ -195,4 +202,4 @@ if (!isLock) { process.on('uncaughtException', function (err) { log.info("***WHOOPS TIME****"+err) }) -} +} \ No newline at end of file