SystemTray on Wayland with Xwayland

Philip Race philip.race at oracle.com
Wed Apr 3 15:53:41 UTC 2024


You don't say what JDK versions you are using. Nor do you say what 
version of Gnome is in use.

A number of distros started to not support the system tray by default 
requiring the user to install an extension.
As such it isn't clear that there is a long term future for what you need.
But installing that extension might be want you need to do to get it.

FYI JDK basically looks for (IIRC) an owner for the atom 
_NET_SYSTEM_TRAY to determine if there is a System Tray.

But on top of that the VERY latest JDK's like 22, the latest updates for 
21u, 17u, 11u, 8u all disable the system tray
unless you have gnome 45 or later. We were forced to do this because of 
a platform bug affecting conformance

release note here 
https://www.oracle.com/java/technologies/javase/22-relnote-issues.html

There is no way to bypass this / re-enable it because it is a 
conformance issue.

-phil.

On 4/3/24 8:35 AM, Simon Nash wrote:
> My application creates a SystemTray icon as its primary user 
> interface. This has caused issues with some desktops (notably GNOME 
> shell) but so far I have been able to find workarounds for these issues.
>
> Until now, SystemTray has worked perfectly on Raspberry Pi OS. The 
> latest version of this (based on Debian bookworm) uses Wayland by 
> default instead of X11. The xwayland apt package is installed. 
> SystemTray is not working in this environment, with 
> SystemTray.isSupported() returning false.
>
> There is a raspi-config option to use X11 instead of Wayland. If I 
> select this and reboot, everything works perfectly as previously. For 
> now, I can tell users to do this but at some point there will be Linux 
> distros with no option to make this change.
>
> I have searched extensively to try to find out if this is a known 
> issue or limitation and I haven't found anything. There is JDK-8146318 
> but this is very old and seems to be a different issue.
>
> Should it be possible to make SystemTray work with the current JDK on 
> Wayland with xwayland by setting some system configuration? (I have 
> tried the latest JDK 23 EA build.) If not, is there any possibility 
> that this could be fixed by a change in the JDK?
>
> Many thanks,
> Simon 



More information about the client-libs-dev mailing list