Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the Java SWT program icon in the Dock when the application is in the tray

I know there are a lot of questions similar to mine, but I actually couldn't solve my problem even after reading all of them. I have a Java application that as soon as it starts it goes on tray. The problem is on Mac, because only there the icon is in the tray bar AND in the Dock. I want to get rid of the Dock icon.

I did already a number of trials: try to wrap my jar in a ".app" folder and writing an Info.plist file. I inserted the LSUIElement and set it to "1" or to "true". This hides the application Icon, but shows an ugly grey icon terminal-like that remains in the terminal.

screen

Tell me even if you have any ideas or other ways to bypass this. thankyou.

like image 935
hurtledown Avatar asked Nov 23 '11 17:11

hurtledown


1 Answers

You may be using the wrong property name for what you want. Have a look here:

https://developer.apple.com/library/mac/#documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html

The property you want to set is, I think:

"apple.awt.UIElement" (not "LSUIElement")

There are two ways you can do that. You can pass:

-Dapple.awt.UIElement="true"

as a VM argument, or you can set a property in the Info.plist as:

<key>Properties</key>
  <dict>
    <key>apple.awt.UIElement</key>
    <string>true</string>
  </dict>
like image 146
Dave Avatar answered Oct 22 '22 14:10

Dave