dustinkredmond / FXTrayIcon

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

Application doesn't start #45

Closed palexdev closed 1 year ago

palexdev commented 2 years ago

It appears the application hangs indefinitely on this line of code: FXTrayIcon

Edit: Wrapping the icon instantiation and show in a SwingUtilities.invokeLater seems to fix the issue but the icon in the tray in just a black rectangle. But this is probably fault of GNOME for not having tray support natively (needs shell extension)

dustinkredmond commented 2 years ago

@palexdev there are some known compatibility issues with certain Linux desktop environments. Can you please send the specs of your current setup?

I could have sworn at one point that I had this library working on a test VM with GNOME as the desktop environment.

palexdev commented 2 years ago

@palexdev there are some known compatibility issues with certain Linux desktop environments. Can you please send the specs of your current setup?

I could have sworn at one point that I had this library working on a test VM with GNOME as the desktop environment.

Of course, what do you need exactly?

dustinkredmond commented 2 years ago

Linux Distribution/version, and version of GNOME if you could, please.

palexdev commented 2 years ago

OS: Garuda Linux x86_64 Kernel: 5.16 DE: GNOME 41.4 Full info from neofetch: Screenshot

dustinkredmond commented 2 years ago

@palexdev I will check further this weekend. Most folks don't even get to the black rectangle on GNOME, as I've seen in the past. I'm assuming that FXTrayIcon.isTrayIconSupported() returns true?

palexdev commented 2 years ago

I didn't test it but I strongly believe it returns false by default.

In my case it returns true because I use one of these GNOME extensions: 1, 2

palexdev commented 2 years ago

@dustinkredmond any news on this?

dustinkredmond commented 2 years ago

@palexdev I apologize for the delay, as I'm in the process of moving and still don't have internet at my new residence. Since you're using an extension to GNOME that causes the library to return true, I'm not sure how best to handle this.

Unfortunately, I don't think we can support this due to the limitations imposed by AWT. I haven't found an acceptable workaround, so ideally FXTrayIcon's isSupported should return false. I hate to hardcode a return of false in the event that someone is using the same platform/extensions that you are, but I also hate that it returns true when it's ultimately not supported.

Let me get the other maintainers' opinions on how best to handle this. I definitely don't want the library hanging up an application because of an incorrect return value from isSupported.

EasyG0ing1 commented 2 years ago

@palexdev Hi, I installed Garuda on a Virtual Machine (nice OS by the way) ... but am now curious after reading Dustins last comment... I remember that when it comes to GUIs in Linux, that the area of the GUI that is the "system tray" can be handled differently depending on different factors.

I found this link that seems to be some kind of plug-in for Gnome that tries to make System Tray interaction with Java a little easier. But what I found most interesting about that link is all the discussion concerning many of the issues that Dustin described when trying to implement a TrayIcon in a Linux environment along with some good explanations as to why those issues exist, and it even offers some suggestions to make things work ... you might find some of the info enlightening and perhaps even useful. It's a good read either way.

The entire TrayIcon functionality within Java - since the beginning - has been weak and has never gotten much attention from Java development in spite of healthy discussions happening at their level concerning that functionality. They seem to have handled Windows and MacOS well enough to where we can at least have some basic abilities, but when it comes to Linux, I think they just have never had the inclination to invest the amount of effort needed to get that piece of Java dialed in so that it works fluidly, predictably and mechanically identical across all platforms. This is unfortunate, but for now, is our reality.

dustinkredmond commented 2 years ago

I'm happy to leave this issue open if folks want to further explore possibilities for a fix. Ultimately, FXTrayIcon is (and always has been) nothing more than an abstraction over the AWT API. This really limits the possibilities we have for improvement, as we rely on the underlying implementation to be solid. If you all want to explore this further, please use this Issue to further discuss, otherwise, please close if you deem relevant. Thanks all for your contributions!

EasyG0ing1 commented 2 years ago

@dustinkredmond - Since I'm more of a "use if arm twisted" - style of Linux user, I have no interest in devoting large amounts of time to further its cause ... JavaFX doesn't seem to be particularly welcome much anywhere in the Linux space from what I gathered with the time I spent looking into the issues. I don't usually - as a rule - go where I'm not welcome. ☺

EasyG0ing1 commented 2 years ago

@dustinkredmond

@palexdev I will check further this weekend. Most folks don't even get to the black rectangle on GNOME, as I've seen in the past. I'm assuming that FXTrayIcon.isTrayIconSupported() returns true?

As I've been testing GistFX on Linux (Ubuntu latest version) I've been noticing that FXT returns true on the supported test, but it ends up hanging the application so I just coded FXT out of the app if Linux is running, just to safe.

dustinkredmond commented 1 year ago

Closing issue, preferring to keep discourse on #12 which addresses attempts to get the library working on Linux in general.