How to hide dock icon?


#1

Hi,

I’d like to run my application on OSX without dock icon.
So, I invoke statically Process::setDockIconVisible(false) in the initialise method of the application.

But, a dock icon appears anyway…
Did I miss something ?


#2

Not sure what to say - I use that methods and it works for me…


#3

Maybe I misuse it.

I intend to build a GUI app without dock icon.
That is, the same effect that you get by setting the LSUIElement to 1 in the Info.plist but without letting any user a chance to unset this parm.

Reading the Apple doc, I found that the value NSApplicationActivationPolicyProhibited that’s passed to [NSApp setActivationPolicy] when setting setDockIconVisible to false is intended to be applied to background applications. In my case, it seems that I should rather use the NSApplicationActivationPolicyAccessory value.

Is this assumption correct ?


#4

I tried NSApplicationActivationPolicyAccessory but it doesn’t work either (on 10.6.8).


#5

It was only introduced in 10.7.


#6

Nevertheless, the Apple’s doc tells me that this behaviour should be available from the 10.6.
(see setActivationPolicy at http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/NSApplication/setActivationPolicy:).

Thank you anyway.