From 483b01c8b69509914d99125dc3099fd4c63a805e Mon Sep 17 00:00:00 2001 From: yu <191972707@qq.com> Date: Fri, 30 Oct 2026 14:42:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=BE=E5=8F=96/=E6=A1=86=E9=80=89?= =?UTF-8?q?=E7=9A=84=E7=AA=97=E5=8F=A3=E6=94=B6=E9=9B=86=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=9C=80=E5=B0=8F=E5=8C=96=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=81=A2=E5=A4=8D=E6=97=B6=20show+restore+focus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/desktop-pick.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/desktop-pick.ts b/src/main/desktop-pick.ts index beb6f1e..ebf8efc 100644 --- a/src/main/desktop-pick.ts +++ b/src/main/desktop-pick.ts @@ -28,7 +28,7 @@ export interface DesktopPickResult { } export async function pickDesktopElement(): Promise { - const appWindows = BrowserWindow.getAllWindows().filter(w => !w.isDestroyed() && w.isVisible()); + const appWindows = BrowserWindow.getAllWindows().filter(w => !w.isDestroyed()); for (const w of appWindows) w.minimize(); try { const { stdout } = await run("powershell.exe", ["-NoProfile", "-STA", "-ExecutionPolicy", "Bypass", "-File", pickerScriptPath()], { timeout: 180000, windowsHide: true, maxBuffer: 4 * 1024 * 1024 }); @@ -55,7 +55,7 @@ export async function listVisibleWindows(): Promise; } export async function pickScreenRegion(): Promise<{ x: number; y: number; width: number; height: number; imagePath: string }> { - const appWindows = BrowserWindow.getAllWindows().filter(w => !w.isDestroyed() && w.isVisible()); + const appWindows = BrowserWindow.getAllWindows().filter(w => !w.isDestroyed()); for (const w of appWindows) w.minimize(); const display = screen.getPrimaryDisplay(); const sx = display.bounds.x, sy = display.bounds.y, sw = display.bounds.width, sh = display.bounds.height; @@ -94,7 +94,7 @@ export async function pickScreenRegion(): Promise<{ x: number; y: number; width: if ((error as Error).message.includes("已取消框选")) throw error; } } - for (const w of appWindows) { if (!w.isDestroyed()) w.restore(); } + for (const w of appWindows) { if (!w.isDestroyed()) { w.show(); w.restore(); w.focus(); } } win.destroy(); if (!region) throw new RuntimeError("pick_cancelled", "未完成框选"); await new Promise(r => setTimeout(r, 300));