feat: show app in Dock when main window is open

This commit is contained in:
ParrotXray 2026-06-10 16:20:58 +08:00
parent 28939f68ff
commit c74d023242
4 changed files with 9 additions and 13 deletions

View File

@ -632,7 +632,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 0.8.1;
MARKETING_VERSION = 0.1.0-modification;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.winddog.wallpaper-engine";
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
@ -671,7 +671,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 0.8.1;
MARKETING_VERSION = 0.1.0-modification;
PRODUCT_BUNDLE_IDENTIFIER = "com.winddog.wallpaper-engine";
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -52,11 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
}
func applicationDidBecomeActive(_ notification: Notification) {
NSApp.setActivationPolicy(.accessory)
}
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !self.mainWindowController.window.isVisible && !settingsWindow.isVisible {
self.mainWindowController.window?.makeKeyAndOrderFront(nil)
}
@ -75,6 +71,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
}
@objc func openMainWindow() {
NSApp.setActivationPolicy(.regular)
self.mainWindowController.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
@ -158,4 +155,4 @@ enum SettingsToolbarIdentifiers {
static let general = NSToolbarItem.Identifier(rawValue: "general")
static let plugins = NSToolbarItem.Identifier(rawValue: "plugins")
static let about = NSToolbarItem.Identifier(rawValue: "about")
}
}

View File

@ -46,6 +46,7 @@ class MainWindowController: NSWindowController, NSWindowDelegate {
func windowWillClose(_ notification: Notification) {
AppDelegate.shared.contentViewModel.isStaging = false
NSApp.setActivationPolicy(.accessory)
}
func windowDidResignKey(_ notification: Notification) {
@ -65,4 +66,4 @@ class MainWindowController: NSWindowController, NSWindowDelegate {
}
}
}
}
}

View File

@ -2,9 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSUIElement</key>
<true/>
<key>NSAppTransportSecurity</key>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
@ -18,4 +16,4 @@
</dict>
</dict>
</dict>
</plist>
</plist>