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.
A:
If this is the only UI that your application has to offer, you can give it an LSUIElement
Info.plist key, which prevents it from being in the Dock or being the active application.
John Calsbeek
2009-12-25 03:36:05
Nope, I have a different window that shows up when you use the application. And that window behaves like any normal application window would so I can't use LSUIElement.
2009-12-25 03:46:33
Why not? It certainly seems like what you want.
Ciarán Walsh
2009-12-25 04:12:22
Nope, I want a dock icon for my application.
2009-12-25 04:23:08
+1
A:
You can either have a faceless helper app that does this for you or get the PSN of the frontmost process before you're brought forward and switch back to it when you want to go away.
Azeem.Butt
2009-12-25 04:20:10
+3
A:
Call [NSApp hide]
That will hide your application and activate the previously-active application.
Darren
2009-12-25 05:52:15