From 435f93865d46aa7ed243140931dafef7671491d4 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 23 Oct 2018 12:23:33 +0200 Subject: [PATCH] Added support for wayland with gnome-shell. --- src/dorkbox/systemTray/SystemTray.java | 13 ++++++++++--- src/dorkbox/systemTray/gnomeShell/Extension.java | 15 ++++++++++++++- .../ui/gtk/_GtkStatusIconNativeTray.java | 5 ----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/dorkbox/systemTray/SystemTray.java b/src/dorkbox/systemTray/SystemTray.java index 5b6daf1..fa75408 100644 --- a/src/dorkbox/systemTray/SystemTray.java +++ b/src/dorkbox/systemTray/SystemTray.java @@ -246,7 +246,9 @@ class SystemTray { } if ("gnome".equalsIgnoreCase(GDM)) { + // install the Gnome extension Tray.usingGnome = true; + Extension.install(); // are we fedora? If so, what version? // now, what VERSION of fedora? 23/24/25/? don't have AppIndicator installed, so we have to use GtkStatusIcon @@ -274,7 +276,10 @@ class SystemTray { return selectTypeQuietly(TrayType.GtkStatusIcon); } else if ("default".equalsIgnoreCase(GDM)) { + // install the Gnome extension Tray.usingGnome = true; + Extension.install(); + // this can be gnome3 on debian/kali if (OSUtil.Linux.isKali()) { @@ -300,11 +305,13 @@ class SystemTray { return selectTypeQuietly(TrayType.GtkStatusIcon); } else if ("ubuntu".equalsIgnoreCase(GDM)) { - // ubuntu 17.10 uses the NEW gnome DE, which screws up previous Ubuntu workarounds, since it's now proper Gnome + // ubuntu 17.10+ uses the NEW gnome DE, which screws up previous Ubuntu workarounds, since it's now proper Gnome int[] version = OSUtil.Linux.getUbuntuVersion(); if (version[0] > 17 || (version[0] == 17 && version[1] == 10)) { // this is gnome 3.26.1 - logger.debug("This Ubuntu 17.10 is not yet supported!"); + // install the Gnome extension + Tray.usingGnome = true; + Extension.install(); } return selectTypeQuietly(TrayType.AppIndicator); @@ -328,7 +335,7 @@ class SystemTray { return selectTypeQuietly(TrayType.AppIndicator); } case Unity7: { - // Ubuntu Unity7 (17.04+, which has MIR) is a weird combination. It's "Gnome", but it's not "Gnome Shell". + // Ubuntu Unity7 (17.04, which has MIR) is a weird combination. It's "Gnome", but it's not "Gnome Shell". return selectTypeQuietly(TrayType.AppIndicator); } case XFCE: { diff --git a/src/dorkbox/systemTray/gnomeShell/Extension.java b/src/dorkbox/systemTray/gnomeShell/Extension.java index ac80be3..bb00f01 100644 --- a/src/dorkbox/systemTray/gnomeShell/Extension.java +++ b/src/dorkbox/systemTray/gnomeShell/Extension.java @@ -169,9 +169,22 @@ class Extension { private static void restartShell() { + if (OSUtil.DesktopEnv.isWayland()) { + // you can no longer restart the shell in wayland. You must logout-login for shell modifications to apply + // https://mail.gnome.org/archives/commits-list/2015-March/msg01019.html + + // HOWEVER, with wayland, shell-extensions that DO NO MODIFY THE GUI (we don't, we just add icons to it) + // are enabled without a shell restart. + + // if there are still difficulties, you can use the following + // gnome-shell-extension-tool -e SystemTray@Dorkbox + return; + } + + if (ENABLE_SHELL_RESTART) { if (SystemTray.DEBUG) { - logger.debug("DEBUG mode enabled. You need to log-in/out or manually restart the shell via '{}' to apply the changes.", + logger.debug("DEBUG mode enabled. You need to log-out/in or manually restart the shell via '{}' to apply the changes.", SHELL_RESTART_COMMAND); return; } diff --git a/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java b/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java index d4a251d..f91ffbc 100644 --- a/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java +++ b/src/dorkbox/systemTray/ui/gtk/_GtkStatusIconNativeTray.java @@ -222,11 +222,6 @@ class _GtkStatusIconNativeTray extends Tray { }); bind(gtkMenu, null, systemTray); - - // install the Gnome extension - if (Tray.usingGnome) { - Extension.install(); - } } @Override