From d8fdbebc4b653fa40dd5d537af8a5782fd658cbc Mon Sep 17 00:00:00 2001 From: Memory <134070804+Memory2314@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:41:35 +0800 Subject: [PATCH] fix: shortcut window display issue --- src/main/index.ts | 12 ++++++++---- src/main/resolve/shortcut.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index a9771d5..e401eee 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -433,12 +433,16 @@ export async function createWindow(): Promise { } } -export function triggerMainWindow(): void { +export function triggerMainWindow(force?: boolean): void { if (mainWindow) { getAppConfig() - .then(({ triggerMainWindowBehavior = 'show' }) => { - if (triggerMainWindowBehavior === 'toggle' && mainWindow?.isVisible()) { - closeMainWindow() + .then(({ triggerMainWindowBehavior = 'toggle' }) => { + if (force === true || triggerMainWindowBehavior === 'toggle') { + if (mainWindow?.isVisible()) { + closeMainWindow() + } else { + showMainWindow() + } } else { showMainWindow() } diff --git a/src/main/resolve/shortcut.ts b/src/main/resolve/shortcut.ts index e0b0f54..7746d8d 100644 --- a/src/main/resolve/shortcut.ts +++ b/src/main/resolve/shortcut.ts @@ -27,7 +27,7 @@ export async function registerShortcut( switch (action) { case 'showWindowShortcut': { return globalShortcut.register(newShortcut, () => { - triggerMainWindow() + triggerMainWindow(true) }) } case 'showFloatingWindowShortcut': {