Let's saying the user is currently on Chrome. So I have a HUD that is invoked by a global hotkey, the user then types something into it and on clicking Close or OK, the HUD goes away (just using [NSPanel orderOut:]) but my application is still focused (i.e. the Menu bar of my application is still visible). But I want the focus to go back to original application, Chrome. How do I achieve something like this? Ideally, I'd also be able to never "get" focus to my application and hence, the HUD input would all happen while Chrome was still the focused application. Things.app manages to achieve something like this. Quicksilver does this too.
Call [NSApp hide:]
That will hide your application and activate the previously-active application.
In order to never get the focus on your application call [panel setStyleMask:[panel styleMask] | NSNonactivatingPanelMask];
on your NSPanel or check the Non Activating checkbox on your NSPanel in Interface Builder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With