From 82e2e249bd57ccd0bad87175b16a6631e8794580 Mon Sep 17 00:00:00 2001 From: Oliver Schwendener Date: Fri, 13 Dec 2024 14:43:36 +0100 Subject: [PATCH] feat: support "--toggle" cli argument when launching second instance --- src/main/Core/BrowserWindow/BrowserWindowModule.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/Core/BrowserWindow/BrowserWindowModule.ts b/src/main/Core/BrowserWindow/BrowserWindowModule.ts index f1703d1ef..8fe6bba34 100644 --- a/src/main/Core/BrowserWindow/BrowserWindowModule.ts +++ b/src/main/Core/BrowserWindow/BrowserWindowModule.ts @@ -166,7 +166,13 @@ export class BrowserWindowModule { ipcMain.on("escapePressed", () => shouldHideWindowOnEscapePressed() && browserWindowToggler.hide()); - app.on("second-instance", () => browserWindowToggler.showAndFocus()); + app.on("second-instance", (_, argv) => { + if (argv.includes("--toggle")) { + browserWindowToggler.toggle(); + } else { + browserWindowToggler.showAndFocus(); + } + }); BrowserWindowModule.registerUeliCommandEvents(browserWindow, eventSubscriber, browserWindowToggler); }