You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new cooperative app activation thing in macOS 14 is great. There is one common use-case it does not cover, however. I need the ability to yield the activation status back to the previously active app.
My use-case is that I have a menu bar app. When a user clicks its menu bar icon, it opens a window and activates the app. When the user is done and clicks the menu bar item again, the app remains activated. The ideal behavior here would be that the previously activated app would regain activation status.
Maybe NSApp.yield() without any parameters would do the correct thing. So you could call it whenever you did not need activation status anymore.
Alternatively, expose the previously active app somehow, so I could call NSApp.yield(to: NSApp.previouslyActivatedApp).
My current ugly workaround is to do this when the window closes:
// Ensure we don’t hide app when other windows are open.
if !NSApp.windows.filter {/* filter out the menu bar item window */}.contains(where: \.isVisible){NSApp.hide(nil)}
The text was updated successfully, but these errors were encountered:
Description
The new cooperative app activation thing in macOS 14 is great. There is one common use-case it does not cover, however. I need the ability to yield the activation status back to the previously active app.
My use-case is that I have a menu bar app. When a user clicks its menu bar icon, it opens a window and activates the app. When the user is done and clicks the menu bar item again, the app remains activated. The ideal behavior here would be that the previously activated app would regain activation status.
Maybe
NSApp.yield()
without any parameters would do the correct thing. So you could call it whenever you did not need activation status anymore.Alternatively, expose the previously active app somehow, so I could call
NSApp.yield(to: NSApp.previouslyActivatedApp)
.My current ugly workaround is to do this when the window closes:
The text was updated successfully, but these errors were encountered: