Fix dock icon persistence when launching externally
This commit is contained in:
parent
b1b049eb8a
commit
f03b0f3a18
@ -7,12 +7,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
|
||||
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
|
||||
updateActivationPolicy()
|
||||
|
||||
if !flag {
|
||||
createMainWindowIfNeeded()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ notification: Notification) {
|
||||
updateActivationPolicy()
|
||||
}
|
||||
|
||||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -64,6 +64,12 @@ class MenuBarManager: ObservableObject {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
if self.isMenuBarOnly {
|
||||
NSApp.setActivationPolicy(.accessory)
|
||||
} else {
|
||||
NSApp.setActivationPolicy(.regular)
|
||||
}
|
||||
|
||||
// Activate the app
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user