-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tray icon is non-transparent on some Linux desktop environments #82
Comments
@crschnick I'm curious as to how you got a TrayIcon to work in Linux at all. The last time I looked into it, Gnome didn't even have a system tray which necessitated adding a third-party system tray and that's as far as I got. Could you share how you got FXTrayIcon working on the various Linux desktops? Also, FXTrayIcon is a wrapper for AWT (JavaFX doesn't support system tray icons). The rendering of the icon image itself happens outside of FXTrayIcon's control. We have noticed that different desktops like different image sizes for the icon. For example, Windows likes a 16x16 icon image while MacOS likes a 22x22 icon image. Going larger than 22x22 in MacOS (for example) changes nothing while going larger in Windows distorts the icon. You might try playing with different icon sizes in the various desktop environments to see if you can find their "sweet spot" icon size so that your icon doesn't look like the odd man out. |
It works out of the box for me on Manjaro and EndeavourOS but not on something like Ubuntu. I didn't do anything special here, it just worked. I guess the issue lies with a bad AWT implementation: https://stackoverflow.com/questions/331407/java-trayicon-using-image-with-transparent-background?rq=4 . Judging from the age of that issue, it's probably not going to get fixed. |
I managed to fix the issue with an ugly reflection hack: https://github.com/xpipe-io/xpipex/blob/a716708f45353fb610b8a32ebea79ce3abc6315d/app/src/main/java/io/xpipe/app/core/AppTray.java#L82 |
@crschnick There has been an open issue with implementing Tray Icons in the official JavaFX developers issue tracker for close to 8 years now. It looked like it was gaining some traction, and then stopped dead in its tracks. They apparently were looking for someone who could basically back-engineer the AWT code and adapt it to total native FX ... but no one had taken it on the last time I checked. Glad you found a fix for this. |
I have tested my application xpipe on various Linux distros and noticed that the tray icon it looks off on some of them. Here is for example how it looks on manjaro with Plasma and KWin (the default Manjaro ones):
On any other operating system or DEs like gnome it looks fine.
For reference, this is the code I use to call FXTrayIcon: https://github.com/xpipe-io/xpipex/blob/d2ac3383ac0b6202f567f42b963819f10b0c98c8/app/src/main/java/io/xpipe/app/core/AppTray.java
The text was updated successfully, but these errors were encountered: