For Java Apps:
Actually for JDownloader case, It's a modular design. Tray icon comes as a plugin that can be disabled from:
JDownloader → Addons → Addon Manager → Extensions → Uncheck Activate box for JD Light Tray
For Java applications general case, It is possible to use Java security manager by writing a custom policy rules.
Create java.policy
file in ~/.jdownloader
contains:
grant codeBase "file:/home/user/.jdownloader/-" {
// full access
// permission java.security.AllPermission;
// AWTPermission full or only selected elements from it
// permission java.awt.AWTPermission "*";
permission java.awt.AWTPermission "accessClipboard";
permission java.awt.AWTPermission "accessEventQueue";
// permission java.awt.AWTPermission "accessSystemTray";
permission java.awt.AWTPermission "createRobot";
permission java.awt.AWTPermission "fullScreenExclusive";
permission java.awt.AWTPermission "listenToAllAWTEvents";
permission java.awt.AWTPermission "readDisplayPixels";
permission java.awt.AWTPermission "replaceKeyboardFocusManager";
permission java.awt.AWTPermission "setAppletStub";
permission java.awt.AWTPermission "setWindowAlwaysOnTop";
permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
permission java.awt.AWTPermission "toolkitModality";
permission java.awt.AWTPermission "watchMousePointer";
// Added by try and learn
permission java.io.FilePermission "/-", "read,write,delete";
permission java.util.PropertyPermission "*", "read,write";
permission java.util.logging.LoggingPermission "control";
permission java.lang.RuntimePermission "*";
permission java.net.NetPermission "*";
permission java.security.SecurityPermission "*";
permission javax.net.ssl.SSLPermission "*";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.lang.reflect.ReflectPermission "*";
};
Modify jdownloader
launch script to use custom policy
sudo nano /usr/bin/jdownloader
Add: -Djava.security.manager -Djava.security.policy=java.policy
to java command call:
exec java ${JAVA_OPTIONS} -Djava.security.manager -Djava.security.policy=java.policy -jar JDownloader.jar $*
These are the minimum rules that allowed me to launch jdownloader. You may need to add more permissions. Because there is no deny
option you have to write all needed grant
rules.
References:
BTW, try to comment one of the rules by adding //
to the beginning of line; So you can see how the error of denied permissions looks like. It tells you which permission you should to add. Also notice that I have used many -
& *
trying to extend rules as I'm looking for a quick solution (default was AllPermission
anyway) and I'm not looking to jail the application.
Here is a template to start with, trying to grant all possible permissions:
grant codeBase "file:/home/user/.jdownloader/-" {
// permission java.security.AllPermission;
// permission java.awt.AWTPermission "*";
permission java.awt.AWTPermission "accessClipboard";
permission java.awt.AWTPermission "accessEventQueue";
// permission java.awt.AWTPermission "accessSystemTray";
permission java.awt.AWTPermission "createRobot";
permission java.awt.AWTPermission "fullScreenExclusive";
permission java.awt.AWTPermission "listenToAllAWTEvents";
permission java.awt.AWTPermission "readDisplayPixels";
permission java.awt.AWTPermission "replaceKeyboardFocusManager";
permission java.awt.AWTPermission "setAppletStub";
permission java.awt.AWTPermission "setWindowAlwaysOnTop";
permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
permission java.awt.AWTPermission "toolkitModality";
permission java.awt.AWTPermission "watchMousePointer";
permission javax.sound.sampled.AudioPermission "*";
permission javax.security.auth.AuthPermission "*";
// permission javax.security.auth.kerberos.DelegationPermission "";
permission javax.xml.bind.JAXBPermission "*";
permission java.nio.file.LinkPermission "hard";
permission java.nio.file.LinkPermission "symbolic";
permission java.util.logging.LoggingPermission "control";
// permission java.lang.management.ManagementPermission "*";
permission javax.management.MBeanServerPermission "*";
permission javax.management.MBeanTrustPermission "*";
permission java.net.NetPermission "*";
permission java.util.PropertyPermission "*", "read,write";
permission java.lang.reflect.ReflectPermission "*";
permission java.lang.RuntimePermission "*";
permission java.security.SecurityPermission "*";
permission java.io.SerializablePermission "*";
permission java.sql.SQLPermission "*";
permission javax.net.ssl.SSLPermission "*";
permission javax.management.remote.SubjectDelegationPermission "*";
permission javax.xml.ws.WebServicePermission "*";
// permission "*";
permission java.io.FilePermission "/-", "read,write,execute,delete,readlink";
permission javax.management.MBeanPermission "*", "*";
// permission javax.security.auth.PrivateCredentialPermission "", "read";
permission javax.security.auth.kerberos.ServicePermission "*", "initiate,accept";
permission java.net.SocketPermission "*", "accept,connect,listen,resolve";
permission java.net.URLPermission "*";
};
Note:
Java Policy Tools is a GUI tool to edit policy files. It make it more easy t find out all available options from drop box. It should be already install with Java package.
![enter image description here](https://i.stack.imgur.com/1dOi6.png)
I found this, and it's actually excellent. Download, extract, copy resources.zip
to /opt/spotify/spotify-client/Data
(overwriting the existing file), and restart Spotify.
UPDATE: Spotify released a new update, and allowing the update rewrites the resources.zip
file. The theme has considerably changed, so the same zip won't work - however, you just need to copy over resources.zip
, extract, and in the _linux
subdirectory, delete all files and copy over _linux/spotify_icon.ico
from the one that you downloaded, zip it back up and copy the zip file back
Best Answer
It appears that the tray icon cannot be enabled for the 1.0.x client at this time. The issue appears to be longstanding, and is so mentioned at the Spotify community forums: "Linux Spotify client 1.x now in stable"
Regarding bugs/issues in 1.0.23:
For now, Spotify is not willing/able to devote enough development resources to the Linux client. I have remained on the "spotify-client-0.9.17" package, while periodically checking the functionality of the 1.0.x testing releases (I have both the "stable" and "testing" repositories). The '0.9.17' client is disappointingly flakey sometimes (esp. "Spotify Helper" processes), but it still gives me a tray icon and panel info/support with 14.04.