Running Ubuntu 24.10 and KDE 6.6 Plasma. Java TrayIcon stopped working. With this simple code: ``` import java.awt.*; import java.awt.event.*; public class TrayIconExample { public static void main(String[] args) { if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); TrayIcon trayIcon = new TrayIcon(image, "Tray Demo"); trayIcon.setImageAutoSize(true); trayIcon.setToolTip("Tray Icon Demo"); trayIcon.addMouseListener(new MouseAdapter() { u/Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { System.out.println("Left button clicked"); } else if (e.getButton() == MouseEvent.BUTTON3) { System.out.println("Right button clicked"); } else if (e.getButton() == MouseEvent.BUTTON2) { System.out.println("Middle button clicked"); } } }); try { tray.add(trayIcon); } catch (AWTException e) { System.err.println("TrayIcon could not be added."); } } else { System.err.println("System tray not supported!"); } } } ``` Tray icon is correctly added to the tray bar but there is no way to listen to mouse button on it making it unusable. No event is triggered when I click on the tray icon. This issue is blocking making all Java programs that uses a tray icon to not work correcly.
Doesn't seem to be distro specific, seeing this on Arch (Plasma 6.2.4, KDE Frameworks 6.8.0, Qt 6.8.1) Debian Trixie (Plasma 6.2.4, KDE Frameworks 6.6.0, Qt 6.7.2)
I am also experiencing this issue with my app ControllerBuddy -> https://controllerbuddy.org As far as I can tell this appeared with KDE 6.0 - on KDE 5 the tray works flawlessly with AWT. As this issue renders the tray icon useless, in my app I even started checking for KDE versions >= 6 to handle them as if the tray is not supported at all, which is really unfortunate... :( I might be willing to look into this if nobody else cares, but at least some intial pointers on where to start digging would be helpful...