From 87c70cb46e8efcb722bc8c51f93d2e5ae0c31b2c Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sun, 23 Mar 2025 10:44:01 +0800 Subject: [PATCH] Fixed focusing on old windows when opening new windows from tray --- src/services/tray.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/tray.ts b/src/services/tray.ts index ab1dc0af0..2933e49fc 100644 --- a/src/services/tray.ts +++ b/src/services/tray.ts @@ -106,6 +106,12 @@ function updateTrayMenu() { } } + function openNewWindow() { + if (lastFocusedWindow){ + lastFocusedWindow.webContents.send("globalShortcut", "openNewWindow"); + } + } + function triggerKeyboardAction(actionName: KeyboardActionNames) { if (lastFocusedWindow){ lastFocusedWindow.webContents.send("globalShortcut", actionName); @@ -214,7 +220,7 @@ function updateTrayMenu() { label: t("tray.open_new_window"), type: "normal", icon: getIconPath("new-window"), - click: () => triggerKeyboardAction("openNewWindow") + click: () => openNewWindow() }, { label: t("tray.new-note"),