From d2b6e6095d361e540a6745589c7aaa976523057d Mon Sep 17 00:00:00 2001 From: covidisahoax Date: Wed, 4 Dec 2024 16:55:28 -0800 Subject: [PATCH] fix regression (trying to launch a second instance wouldn't have focused main window) --- src/main/index.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index d6dd499608e7c..e15f6e2f4bc5d 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -256,16 +256,14 @@ function runApp() { // Someone tried to run a second instance, we should focus our window if (typeof commandLine !== 'undefined') { const url = getLinkUrl(commandLine) - if (url) { - if (mainWindow && mainWindow.webContents) { - if (mainWindow.isMinimized()) mainWindow.restore() - mainWindow.focus() - - mainWindow.webContents.send(IpcChannels.OPEN_URL, url) - } else { - startupUrl = url - createWindow() - } + if (mainWindow && mainWindow.webContents) { + if (mainWindow.isMinimized()) mainWindow.restore() + mainWindow.focus() + + if (url) mainWindow.webContents.send(IpcChannels.OPEN_URL, url) + } else { + if (url) startupUrl = url + createWindow() } } })