macoscocoaiconsdocklsuielement

How to hide the Dock icon


I want to make a preference for hiding the Dock icon and showing an NSStatusItem. I can create the StatusItem but I don't know how to remove the icon from Dock. :-/

Any ideas?


Solution

  • I think you are looking for the LSUIElement in the Info.plist

    LSUIElement (String). If this key is set to “1”, Launch Services runs the application as an agent application. Agent applications do not appear in the Dock or in the Force Quit window. Although they typically run as background applications, they can come to the foreground to present a user interface if desired.

    See a short discussion here about turning it on/off