How do I hide my app's dock icon?
21/07/03 19:10
I don't want an icon in the dock for my application… |
There currently is no recommended way to remove an application's dock icon at runtime. However, you can fake it in some cases: Create two applications, one of which you declare as a "background-only" application. Background-only applications can not have a UI like windows or a menu bar (though there are exceptions, e.g. you can create a utility window), and do not show up in the dock. You achieve this by setting the app's LSUIElement or LSBackgroundOnly bit to the string (not number!) "1". Put the UI in the other (regular) application, but the beef that makes it tick in the background application, and put the latter application in the former's "Resources" folder (it must be an application package). The two applications can communicate via Apple Events, and when the user wants to use the UI, she can launch the UI application, which can launch the background-only application using Apple Events or Launch Services. |