From f86d4c98266b66e3850aad03a7c41cd42d0a85a7 Mon Sep 17 00:00:00 2001 From: William Date: Tue, 30 Jun 2026 09:04:55 +0600 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=BA=E5=88=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=BF=80=E6=B4=BB=E7=AD=96=E7=95=A5=E4=B8=BA?= =?UTF-8?q?=20regular=EF=BC=8C=E4=BF=AE=E5=A4=8D=20swift=20run=20=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E8=BE=93=E5=85=A5=E7=A9=BF=E9=80=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit swift run 启动的可执行文件默认不被识别为 GUI 应用,需要显式设置 .regular 激活策略 --- .../VODManager/Sources/VODManager/VODManagerApp.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/macos/VODManager/Sources/VODManager/VODManagerApp.swift b/apps/macos/VODManager/Sources/VODManager/VODManagerApp.swift index 3bcc808..1f432ba 100644 --- a/apps/macos/VODManager/Sources/VODManager/VODManagerApp.swift +++ b/apps/macos/VODManager/Sources/VODManager/VODManagerApp.swift @@ -20,9 +20,12 @@ struct VODManagerApp: App { class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ notification: Notification) { + NSApp.setActivationPolicy(.regular) NSApp.activate(ignoringOtherApps: true) - if let window = NSApp.windows.first { - window.makeKeyAndOrderFront(nil) + DispatchQueue.main.async { + for window in NSApp.windows { + window.makeKeyAndOrderFront(nil) + } } }