diff --git a/Mos/Managers/WindowManager.swift b/Mos/Managers/WindowManager.swift index 862860db..05745ba1 100644 --- a/Mos/Managers/WindowManager.swift +++ b/Mos/Managers/WindowManager.swift @@ -37,9 +37,12 @@ extension WindowManager { showWindow(withIdentifier: identifier, withTitle: title) return } - // 显示 + // 取消显示 Dock 图标并激活 App,保留 accessory 模式避免切换 space + // Utils.showDockIcon() + NSApp.activate(ignoringOtherApps: true) + + // 显示并前置窗口 windowController.showWindow(self) - // 前置并激活(已打开窗口也要置顶) if let window = windowController.window { if window.isMiniaturized { window.deminiaturize(self) @@ -47,14 +50,11 @@ extension WindowManager { window.makeKeyAndOrderFront(self) window.orderFrontRegardless() } - NSApp.activate(ignoringOtherApps: true) - // 显示 Dock 图标 - Utils.showDockIcon() } // 关闭对应 Identifier 的窗口 func hideWindow(withIdentifier identifier: String, destroy: Bool = false) { // 隐藏 Dock 图标 - Utils.hideDockIcon() + // Utils.hideDockIcon() // 销毁实例 if destroy { refs.removeValue(forKey: identifier) diff --git a/Mos/Windows/PreferencesWindow/PreferencesWindowController.swift b/Mos/Windows/PreferencesWindow/PreferencesWindowController.swift index 5f311cf2..37c0e65d 100644 --- a/Mos/Windows/PreferencesWindow/PreferencesWindowController.swift +++ b/Mos/Windows/PreferencesWindow/PreferencesWindowController.swift @@ -14,6 +14,10 @@ class PreferencesWindowController: NSWindowController, NSWindowDelegate { override func windowDidLoad() { super.windowDidLoad() + + // Allow the window to appear on the current active space, including fullscreen apps + window?.collectionBehavior = [.moveToActiveSpace, .fullScreenAuxiliary] + // 插入分隔符 if #available(OSX 10.16, *) { window?.toolbar?.insertItem(withItemIdentifier: NSToolbarItem.Identifier.flexibleSpace, at: 4)