Code cleanup
This commit is contained in:
parent
17b3890688
commit
e9228e94b3
@ -38,6 +38,7 @@ import javax.swing.UIManager;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import dorkbox.systemTray.gnomeShell.AppIndicatorExtension;
|
||||||
import dorkbox.systemTray.gnomeShell.DummyFile;
|
import dorkbox.systemTray.gnomeShell.DummyFile;
|
||||||
import dorkbox.systemTray.gnomeShell.LegacyExtension;
|
import dorkbox.systemTray.gnomeShell.LegacyExtension;
|
||||||
import dorkbox.systemTray.ui.awt._AwtTray;
|
import dorkbox.systemTray.ui.awt._AwtTray;
|
||||||
@ -248,12 +249,7 @@ class SystemTray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ("gnome".equalsIgnoreCase(GDM)) {
|
if ("gnome".equalsIgnoreCase(GDM)) {
|
||||||
// install the Gnome extension
|
|
||||||
Tray.usingGnome = true;
|
|
||||||
Extension.install();
|
|
||||||
|
|
||||||
// are we fedora? If so, what version?
|
// 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
|
|
||||||
if (OSUtil.Linux.isFedora()) {
|
if (OSUtil.Linux.isFedora()) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
logger.debug("Running Fedora");
|
logger.debug("Running Fedora");
|
||||||
@ -279,8 +275,8 @@ class SystemTray {
|
|||||||
}
|
}
|
||||||
else if ("default".equalsIgnoreCase(GDM)) {
|
else if ("default".equalsIgnoreCase(GDM)) {
|
||||||
// install the Gnome extension
|
// install the Gnome extension
|
||||||
Tray.usingGnome = true;
|
Tray.gtkGnomeWorkaround = true;
|
||||||
Extension.install();
|
|
||||||
|
|
||||||
// this can be gnome3 on debian/kali
|
// this can be gnome3 on debian/kali
|
||||||
if (OSUtil.Linux.isKali()) {
|
if (OSUtil.Linux.isKali()) {
|
||||||
@ -288,7 +284,7 @@ class SystemTray {
|
|||||||
return selectTypeQuietly(TrayType.GtkStatusIcon);
|
return selectTypeQuietly(TrayType.GtkStatusIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OSUtil.Linux.isDebian() && Extension.ENABLE_EXTENSION_INSTALL) {
|
if (OSUtil.Linux.isDebian()) {
|
||||||
logger.warn("Debian with Gnome detected. SystemTray works, but will only show via SUPER+M.");
|
logger.warn("Debian with Gnome detected. SystemTray works, but will only show via SUPER+M.");
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@ -313,8 +309,8 @@ class SystemTray {
|
|||||||
// ubuntu 17.10+ uses the NEW gnome DE, which screws up previous Ubuntu workarounds, since it's now mostly Gnome
|
// ubuntu 17.10+ uses the NEW gnome DE, which screws up previous Ubuntu workarounds, since it's now mostly Gnome
|
||||||
if (version[0] == 17 && version[1] == 10) {
|
if (version[0] == 17 && version[1] == 10) {
|
||||||
// this is gnome 3.26.1, so we install the Gnome extension
|
// this is gnome 3.26.1, so we install the Gnome extension
|
||||||
Tray.usingGnome = true;
|
Tray.gtkGnomeWorkaround = true;
|
||||||
Extension.install();
|
LegacyExtension.install();
|
||||||
}
|
}
|
||||||
else if (version[0] >= 18) {
|
else if (version[0] >= 18) {
|
||||||
// ubuntu 18.04 doesn't need the extension BUT does need a logout-login (or gnome-shell restart) for it to work
|
// ubuntu 18.04 doesn't need the extension BUT does need a logout-login (or gnome-shell restart) for it to work
|
||||||
@ -918,8 +914,7 @@ class SystemTray {
|
|||||||
} else if (isTrayType(trayType, TrayType.GtkStatusIcon)) {
|
} else if (isTrayType(trayType, TrayType.GtkStatusIcon)) {
|
||||||
if (!LegacyExtension.isInstalled()) {
|
if (!LegacyExtension.isInstalled()) {
|
||||||
// Automatically install the extension for everyone except Arch. They are bonkers.
|
// Automatically install the extension for everyone except Arch. They are bonkers.
|
||||||
Extension.ENABLE_EXTENSION_INSTALL = false;
|
SystemTray.logger.warn("You may need a work-around for showing the SystemTray icon - we suggest installing the " +
|
||||||
SystemTray.logger.info("You may need a work-around for showing the SystemTray icon - we suggest installing the " +
|
|
||||||
"the [Top Icons] plugin (https://extensions.gnome.org/extension/1031/topicons/) which moves " +
|
"the [Top Icons] plugin (https://extensions.gnome.org/extension/1031/topicons/) which moves " +
|
||||||
"icons from the *notification drawer* (it is normally collapsed) at the bottom left corner " +
|
"icons from the *notification drawer* (it is normally collapsed) at the bottom left corner " +
|
||||||
"of the screen to the menu panel next to the clock.");
|
"of the screen to the menu panel next to the clock.");
|
||||||
|
@ -27,8 +27,8 @@ import dorkbox.systemTray.util.ImageResizeUtil;
|
|||||||
// This is public ONLY so that it is in the scope for SwingUI and NativeUI system tray components
|
// This is public ONLY so that it is in the scope for SwingUI and NativeUI system tray components
|
||||||
public
|
public
|
||||||
class Tray extends Menu {
|
class Tray extends Menu {
|
||||||
// true if we are using gnome (and things depend on it) or false
|
// true if we are using gnome (and we have to implement workarounds) or false
|
||||||
public static volatile boolean usingGnome = false;
|
public static volatile boolean gtkGnomeWorkaround = false;
|
||||||
|
|
||||||
// appindicators DO NOT support anything other than PLAIN gtk-menus
|
// appindicators DO NOT support anything other than PLAIN gtk-menus
|
||||||
// they ALSO do not support tooltips!
|
// they ALSO do not support tooltips!
|
||||||
|
@ -215,8 +215,8 @@ class _GtkStatusIconNativeTray extends Tray {
|
|||||||
// BUT this is REQUIRED when running JavaFX or Gnome For unknown reasons, the title isn't pushed to GTK, so our
|
// BUT this is REQUIRED when running JavaFX or Gnome For unknown reasons, the title isn't pushed to GTK, so our
|
||||||
// gnome-shell extension cannot see our tray icon -- so naturally, it won't move it to the "top" area and
|
// gnome-shell extension cannot see our tray icon -- so naturally, it won't move it to the "top" area and
|
||||||
// we appear broken.
|
// we appear broken.
|
||||||
if (JavaFX.isLoaded || Tray.usingGnome) {
|
if (JavaFX.isLoaded || Tray.gtkGnomeWorkaround) {
|
||||||
Gtk2.gtk_status_icon_set_name(trayIcon, Extension.DEFAULT_NAME);
|
Gtk2.gtk_status_icon_set_name(trayIcon, LegacyExtension.DEFAULT_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user