diff --git a/native/app/Source/AppDelegate.swift b/native/app/Source/AppDelegate.swift index 162d9529..72660cb9 100644 --- a/native/app/Source/AppDelegate.swift +++ b/native/app/Source/AppDelegate.swift @@ -59,6 +59,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate { NSWorkspace.shared.notificationCenter.addObserver( self, selector: #selector(willSleep(event:)), name: NSWorkspace.willSleepNotification, object: nil) + + NSWorkspace.shared.notificationCenter.addObserver( + self, selector: #selector(activeSpaceDidChange(event:)), + name: NSWorkspace.activeSpaceDidChangeNotification, object: nil) } func applicationWillTerminate(_ aNotification: Notification) { @@ -129,6 +133,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate { @objc func didWakeUp(event: NSNotification) { Application.handleWakeUp() } -} - + @objc func activeSpaceDidChange(event: NSNotification) { + if UI.hasLoaded && UI.mode == .popover { + UI.close() + } + } +}