Unusable SystemTray on Linux
Opened this issue · 0 comments
alevesely commented
Cannot run nexu-stdalone on a Linux PC running openbox:
2020-05-28 10:22:24,632 [INFO|org.eclipse.jetty.server.Server|Server|JavaFX Application Thread] Started @3570ms
2020-05-28 10:22:24,702 [WARN|dorkbox.systemTray.SystemTray|SystemTray|JavaFX Application Thread] Unable to determine the system window manager type. Falling back to GtkStatusIcon.
(java:4868): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplayManager'
(java:4868): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(java:4868): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
2020-05-28 10:22:34,746 [ERROR|dorkbox.systemTray.SystemTray|Gtk|JavaFX Application Thread] Something is very wrong. The waitForStartup took longer than expected.
java.lang.Exception:
at dorkbox.systemTray.jna.linux.Gtk.waitForStartup(Gtk.java:327)
at dorkbox.systemTray.nativeUI._GtkStatusIconNativeTray.<init>(_GtkStatusIconNativeTray.java:170)
[...]
I also tried to switch to the latest version of Dorkbox SystemTray, 3.17, to no avail.
Finally, I changed the source code as follows:
--- nexu/nexu-standalone/src/main/java/lu/nowina/nexu/SystrayMenu.java 2020-06-01 10:27:05.962977673 +0200
+++ nexu/nexu-standalone/src/main/java/lu/nowina/nexu/SystrayMenu.java 2020-05-31 11:40:31.473236548 +0200
@@ -55,17 +55,20 @@
switch(api.getEnvironmentInfo().getOs()) {
case WINDOWS:
case MACOSX:
+ case LINUX:
// Use reflection to avoid wrong initialization issues
Class.forName("lu.nowina.nexu.systray.AWTSystrayMenuInitializer")
.asSubclass(SystrayMenuInitializer.class).newInstance()
.init(tooltip, trayIconURL, operationFactory, exitMenuItem, systrayMenuItems);
break;
+/*
case LINUX:
// Use reflection to avoid wrong initialization issues
Class.forName("lu.nowina.nexu.systray.DorkboxSystrayMenuInitializer")
.asSubclass(SystrayMenuInitializer.class).newInstance()
.init(tooltip, trayIconURL, operationFactory, exitMenuItem, systrayMenuItems);
break;
+*/
case NOT_RECOGNIZED:
LOGGER.warn("System tray is currently not supported for NOT_RECOGNIZED OS.");
break;
That way nexu-stdalone runs, provided a system tray is available. I used Trayer