Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unusable SystemTray on Linux #32

Open
alevesely opened this issue Jun 1, 2020 · 0 comments
Open

Unusable SystemTray on Linux #32

alevesely opened this issue Jun 1, 2020 · 0 comments

Comments

@alevesely
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant