Skip to main content
May 12, 2011
Question

Hiding dock icon on OSX is impossible?

  • May 12, 2011
  • 2 replies
  • 2569 views

How can I hide the dock icon for an Air application on OSX?

I've tried editing the info.plist for my application and adding LSUIElement=1 (or true, etc), but it doesn't work reliably at all. Sometimes, the first time I run my app the dock icon shows up but after that the dock icon is hidden; sometimes, the dock icon always remains. nativeApplication.dockIcon doesn't let me do what I need, it only lets me change an existing bitmap, not hide the dock entry entirely. And even when it does get hidden from the dock, the (system) menu bar still shows up, which is very strange.

For other applications, this seems to work -- so I can only assume that the Air runtime is doing

TransformProcessType(&psn, kProcessTransformToForegroundApplication);

at runtime to forcibly show its own dock icon, so how can I stop that happening? (context: I have another app which launches my air app and provides services to the air app via a socket -- I want the launcher app to be what's in the dock, so that people who do "pin to dock" will pin the launcher, not just the air part. So I want to hide the air app from the dock and have my launcher be the only thing that shows up).

This topic has been closed for replies.

2 replies

May 24, 2011

This doesn't solve the basic "hide-from-dock" question, but for what it's worth, I only just (embarrassingly) discovered the NativeProcess API, so with a bit of shuffling code around it should be possible to get the end result I want, ie the only thing showing in the dock is the Air app; I'd make the launcher app that we control be hidden from the dock, and then have the Air app run our service, instead of the other way around.

Participant
December 24, 2011

Hey, just wondering if you have made any progress on this issue? Really want a way to hide the dock icon. Thanks.

December 26, 2011

Sorry, I don't think there's any way to do it. The bug in bugbase is marked as "closed, deferred to later, not supported", so I don't think Adobe have any immediate plans to look into it either.

I solved our particular problem, but that was because we have two processes, an Air one and a native one, and we only wanted one dock icon, not two. I don't know how to get down to zero icons when Air is involved.

chris.campbell
Legend
May 12, 2011

Hi Daniel,

Thanks for bringing this up.  I did a quick search on Google and it appears you're not the only one that's run into this with AIR.  I asked around, and while I don't have anything definitive it was recommended that you also try setting LSBackgroundOnly=1 to see if that made a difference.  I've also heard that this might only work with 10.5 and above.  Could you give that a try and see if it helps?  If it doesn't, would you mind opening a new bug at bugbase.adobe.com and post back so that others can add their votes and comments?

Thanks,

Chris

May 17, 2011

I tried adding LSBackgroundOnly, but that doesn't help (and is for apps with _no_ UI, not just with no dock entry). Minimal repro steps here, and I'll post to bugbase as well.

1. Launch Flash Builder (4)
2. File > New > Flex project.
3. Call it "HideDock", set it to air app, SDK 4.1.
4. Run it; an empty window shows up, with the standard ADL dock item (because we're in Flash Builder)
5. Project > Export Release Build, sign it, Finish.
6. Double-click on HideDock.air in Flash Builder; yes, install it, to /Applications, and run it at startup
7. Notice it has an entry in the dock, and when the active app the system menu shows HideDock.

So far, so good, this is as expected. Now let's see if we can get it to not show up in the dock.

8. Run Terminal, 'cd /Applications/HideDock.app/Contents'
9. 'sudo vi Info.plist' (or your editor of choice.. )
10. Before the 'CFBundleDockTypes' entry, add
    <key>LSUIElement</key>
    <string>1</string>
11. Run HideDock again. It still shows up in the dock, even though you've added the "don't show in dock" entry to Info.plist. (also, try <true/> instead of <string>1</string>, and it makes no difference>
12. Add
    <key>LSBackgroundOnly</key>
    <string>1</string>
to Info.plist. This also makes no difference. (and is for things with _no_ UI, so is overkill here).
13. 'touch HideDock.app' in Terminal. This makes no difference.
13. Restart Finder. This makes no difference either. Restart Dock process. This makes no difference.

May 17, 2011

Bugbase entry is here:

https://bugbase.adobe.com/index.cfm?event=bug&id=2875209