[lcox]Q:  How do you make an application hide when it's auto-launched from the dock?

Q:  I'm having trouble getting my application to hide when auto-launched.  What's the correct way to make it happen?

A:  When your application launches, it should check the NXAutoLaunch default.  A ªNOº value means the application wasn't auto-launched from the Dock, and a ªYESº value means it was.  The application should check this value before creating or displaying any user interface.  It should complete its initialization when the user activates it for the first time (the code for detecting and handling this condition should reside within the appDidUnhide: delegate method).

Another approach might be to completely initialize the application and then check the default.  If the auto-launch condition were true, it could send itself the hide: message and disappear.  The first problem with this approach is that it leads to flashing windows, meaning that if (for example) your application creates a default document or displays a palette when it starts up,  the window or palette will appear onscreen, and then quickly disappear when the application hides itself.  The second problem is that some timing snarls in the AppKit currently prevent this (sending the hide: message from within appDidInit:) from working.

QA801

Valid for 2.0
Valid for 3.0