compose-multiplatform: System trays/menus do not work on Ubuntu 18.04 w/ Gnome 3.28.2

Expected Tutorials would work out of the box

Actual

When running the Tray_Notifications_MenuBar tutorials on Ubuntu 18.04, the applications launch but do not function as expected.

There is the standard icon (with an exit option), but none of the application-specified menus. The notifier similarly does not present.

In the same manner, the Windows Attributes tutorial fails, as there are no menu options to click.

When I run this, it confirms that the SystemTray is no longer supported.

        if (!SystemTray.isSupported()) {
            System.out.println("SystemTray is not supported");
        }

I tried TopIconsPlus Gnome shell extension ( as per the Gnome Release notes ) and got the Tray example to work, but not the others. TBH, UI was not great either.

I also tried AppIndicator Gnome shell extension (as per the documentation on https://github.com/dorkbox/SystemTray ). That didn’t work for any of the tutorials.

Suggestions

  • Ideal would be for the Menus, Trays, Notifiers, etc to work out of the box cross-platform. This one is especially the ideal if you are distributing your app.
  • Secondary would be if we checked SystemTray.isSupported() under the hood and directed the user/dev to a wiki on how to fix it. I have not yet managed to fix it myself, so do not have a suggestion on what that option would look like.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@elect86 i made this until we have a better solution:

https://github.com/zoff99/jni_notifications

example usage is included:

https://github.com/zoff99/jni_notifications/blob/master/com/zoffcc/applications/jninotifications/NTFYActivity.java#L146

it works on macOS and on Linux. in windows notifications with try seem to work fine with this

I tried the tutorial on Fedora 33 with Gnome 38 and the extension TrayIcons Reloaded. It more or less works.

Here are the problems that I observe:

  • the tray icon appears with a white background, even if I add some setComposite(AlphaComposite.Clear); fillRect(0,0,size,size); setComposite(AlphaComposite.Src) to the code of getTrayIcon (see screenshots below)
  • I have to right-click to make the menu appear (and not click like for other tray items)
  • the menu that is rendered when I right-click on the tray icon is very-badly rendered and positioned (see screenshots below)
  • the notification window that appears when I click on “Send notification” does not conform to platform notifications and is also very-badly rendered and position (see screenshots below)
  • the “Increment value” menu item does not make the value increment
  • the “Exit” menu item does work and quits the application correctly

I must add that I have a 2x scale factor (high dpi) as I use an 4K screen.

screenshot-1 screenshot-2