dustinkredmond / FXTrayIcon

Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.
MIT License
327 stars 26 forks source link

Doesn't work under Fedora 35 (GNOME 41) #37

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi,

The instance of FXTrayIcon silently blocking at his creation. it seems to be because of GTK (4).

Thanks for your work: I hope this library will become fully functional soon.

dustinkredmond commented 2 years ago

Hi @guiguidu60. Unfortunately, due to the wide range of desktop environments that the various Linux distributions utilize, It would be a constant struggle to support each and every one of them. FXTrayIcon uses AWT to create and render the icon. Unfortunately, the AWT icon does not seem to work on GNOME due to its lacking support for AppIndicator.

Until the various OSes can standardize their approach for the System Tray (which I don't see happening anytime soon), we can't commit to ensuring that FXTrayIcon works on every operating system. The best way to handle this is to call FXTrayIcon.isSupported() and decide whether or not to create an instance based on the result of this method call.

You might also check to see if there's another way to support tray icons in GNOME without relying on AWT or Java, though this might take some native calls to achieve.

ghost commented 2 years ago

I ran the FXTrayIcon.isSupported() and the response is TRUE. It would indeed be necessary to carry out a native implementation to do without AWT.

dustinkredmond commented 2 years ago

@guiguidu60, now that's strange. I would have thought that it should return false. I will look into this and see if we can come up with a better check.

parrotcar00 commented 2 years ago

Do you if it would be possible to add support for Gnome system tray to FXTrayIcon? If it isn't too hard and possible to do, I could try to take a crack at it?

ghost commented 2 years ago

It is obviously possible: it is apparently necessary to make the connection between Java and the library "libappindicator(-gtk)". It doesn't look complicated but you have to know the C language.

dustinkredmond commented 2 years ago

@guiguidu60 & @parrotcar00 Yes, you would have to use App Indicator libraries to achieve this in GNOME. I've looked at this in the past, but don't have the time currently to work out the native code. If someone would like to take a crack at this, I would love to review that PR.