From ae4f0123902e9f3a60ce39e09ecb7ca97b3ff82e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 1 Feb 2025 10:46:27 +0200 Subject: [PATCH] feat(tray): ensure window is visible --- src/services/tray.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/services/tray.ts b/src/services/tray.ts index cd0855d78..756ed7be7 100644 --- a/src/services/tray.ts +++ b/src/services/tray.ts @@ -68,12 +68,21 @@ function updateTrayMenu() { return; } + function ensureVisible() { + if (mainWindow) { + mainWindow.show(); + mainWindow.focus(); + } + } + function triggerKeyboardAction(actionName: KeyboardActionNames) { mainWindow?.webContents.send("globalShortcut", actionName); + ensureVisible(); } function openInSameTab(note: BNote | BRecentNote) { mainWindow?.webContents.send("openInSameTab", note.noteId); + ensureVisible(); } function buildBookmarksMenu() { @@ -127,8 +136,7 @@ function updateTrayMenu() { if (isVisible) { mainWindow.hide(); } else { - mainWindow.show(); - mainWindow.focus(); + ensureVisible(); } } },