From 82494d818b35daca16b318677a7efe4910d875c6 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Sat, 4 Jan 2025 12:41:40 +0100 Subject: [PATCH] fix(macos): show window on dock click when using menu bar mode When "Show in menu bar" is enabled and the window is closed, clicking the app icon in the dock now properly shows the window again instead of only focusing it. --- electron/main/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 9b5e051..f52bd51 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -351,10 +351,14 @@ app.on('second-instance', () => { } }) -app.on('activate', () => { +app.on('activate', (event, hasVisibleWindows) => { const allWindows = BrowserWindow.getAllWindows() if (allWindows.length) { allWindows[0].focus() + // show the window if it's hidden (e.g. the window was closed with "show in menu bar" setting turned on) + if (!allWindows[0].isVisible()) { + allWindows[0].show() + } } else { createWindow() }