Cleaned up comments. Fixed gnome-shell detection (accidentally broke it)
This commit is contained in:
parent
18aa47ae5b
commit
107757ff68
|
@ -72,8 +72,8 @@ class SystemTray {
|
||||||
public static boolean FORCE_GTK2 = true;
|
public static boolean FORCE_GTK2 = true;
|
||||||
|
|
||||||
@Property
|
@Property
|
||||||
/** If != 0, forces the system tray in linux to be GTK (1), AppIndicator (2), or Swing (3). This is an advanced feature. */
|
/** Forces the system tray detection to be Automatic (0), GTK (1), AppIndicator (2), or Swing (3). This is an advanced feature. */
|
||||||
public static int FORCE_LINUX_TYPE = 1;
|
public static int FORCE_LINUX_TYPE = 0;
|
||||||
|
|
||||||
@Property
|
@Property
|
||||||
/**
|
/**
|
||||||
|
@ -201,11 +201,11 @@ class SystemTray {
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
switch (FORCE_LINUX_TYPE) {
|
switch (FORCE_LINUX_TYPE) {
|
||||||
case 1: logger.debug("Forcing GTK type"); break;
|
case 1: logger.debug("Forced tray type: GtkStatusIcon"); break;
|
||||||
case 2: logger.debug("Forcing AppIndicator type"); break;
|
case 2: logger.debug("Forced tray type: AppIndicator"); break;
|
||||||
case 3: logger.debug("Forcing Swing type"); break;
|
case 3: logger.debug("Forced tray type: Swing"); break;
|
||||||
|
|
||||||
default: logger.debug("Auto-detecting indicator type"); break;
|
default: logger.debug("Auto-detecting tray type"); break;
|
||||||
}
|
}
|
||||||
logger.debug("FORCE_GTK2: {}", FORCE_GTK2);
|
logger.debug("FORCE_GTK2: {}", FORCE_GTK2);
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ class SystemTray {
|
||||||
// appindicator3 doesn't support menu icons via GTK2!!
|
// appindicator3 doesn't support menu icons via GTK2!!
|
||||||
if (Gtk.isGtk2 || AppIndicator.isVersion3) {
|
if (Gtk.isGtk2 || AppIndicator.isVersion3) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
logger.trace("Loading libraries");
|
logger.debug("Loading libraries");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,61 +295,35 @@ class SystemTray {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ("unity".equalsIgnoreCase(XDG)) {
|
if (trayType == null) {
|
||||||
try {
|
if ("unity".equalsIgnoreCase(XDG)) {
|
||||||
trayType = AppIndicatorTray.class;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEBUG) {
|
|
||||||
logger.error("Cannot initialize AppIndicatorTray", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ("xfce".equalsIgnoreCase(XDG)) {
|
|
||||||
try {
|
|
||||||
trayType = AppIndicatorTray.class;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEBUG) {
|
|
||||||
logger.error("Cannot initialize AppIndicatorTray", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// we can fail on AppIndicator, so this is the fallback
|
|
||||||
try {
|
try {
|
||||||
trayType = GtkSystemTray.class;
|
trayType = AppIndicatorTray.class;
|
||||||
} catch (Throwable e1) {
|
} catch (Throwable e) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
logger.error("Cannot initialize GtkSystemTray", e1);
|
logger.error("Cannot initialize AppIndicatorTray", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if ("xfce".equalsIgnoreCase(XDG)) {
|
||||||
else if ("lxde".equalsIgnoreCase(XDG)) {
|
try {
|
||||||
try {
|
trayType = AppIndicatorTray.class;
|
||||||
trayType = GtkSystemTray.class;
|
} catch (Throwable e) {
|
||||||
} catch (Throwable e) {
|
if (DEBUG) {
|
||||||
if (DEBUG) {
|
logger.error("Cannot initialize AppIndicatorTray", e);
|
||||||
logger.error("Cannot initialize GtkSystemTray", e);
|
}
|
||||||
|
|
||||||
|
// we can fail on AppIndicator, so this is the fallback
|
||||||
|
try {
|
||||||
|
trayType = GtkSystemTray.class;
|
||||||
|
} catch (Throwable e1) {
|
||||||
|
if (DEBUG) {
|
||||||
|
logger.error("Cannot initialize GtkSystemTray", e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if ("lxde".equalsIgnoreCase(XDG)) {
|
||||||
else if ("kde".equalsIgnoreCase(XDG)) {
|
|
||||||
isKDE = true;
|
|
||||||
try {
|
|
||||||
trayType = AppIndicatorTray.class;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEBUG) {
|
|
||||||
logger.error("Cannot initialize AppIndicatorTray", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ("gnome".equalsIgnoreCase(XDG)) {
|
|
||||||
// check other DE
|
|
||||||
String GDM = System.getenv("GDMSESSION");
|
|
||||||
|
|
||||||
if (DEBUG) {
|
|
||||||
logger.debug("Currently using the '{}' session type", GDM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("cinnamon".equalsIgnoreCase(GDM)) {
|
|
||||||
try {
|
try {
|
||||||
trayType = GtkSystemTray.class;
|
trayType = GtkSystemTray.class;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -358,31 +332,60 @@ class SystemTray {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ("gnome-classic".equalsIgnoreCase(GDM)) {
|
else if ("kde".equalsIgnoreCase(XDG)) {
|
||||||
|
isKDE = true;
|
||||||
try {
|
try {
|
||||||
trayType = GtkSystemTray.class;
|
trayType = AppIndicatorTray.class;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
logger.error("Cannot initialize GtkSystemTray", e);
|
logger.error("Cannot initialize AppIndicatorTray", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ("gnome-fallback".equalsIgnoreCase(GDM)) {
|
else if ("gnome".equalsIgnoreCase(XDG)) {
|
||||||
try {
|
// check other DE
|
||||||
trayType = GtkSystemTray.class;
|
String GDM = System.getenv("GDMSESSION");
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
logger.error("Cannot initialize GtkSystemTray", e);
|
logger.debug("Currently using the '{}' session type", GDM);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("cinnamon".equalsIgnoreCase(GDM)) {
|
||||||
|
try {
|
||||||
|
trayType = GtkSystemTray.class;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (DEBUG) {
|
||||||
|
logger.error("Cannot initialize GtkSystemTray", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if ("gnome-classic".equalsIgnoreCase(GDM)) {
|
||||||
else if ("ubuntu".equalsIgnoreCase(GDM)) {
|
try {
|
||||||
// have to install the gnome extension AND customize the restart command
|
trayType = GtkSystemTray.class;
|
||||||
trayType = null;
|
} catch (Throwable e) {
|
||||||
GnomeShellExtension.SHELL_RESTART_COMMAND = "unity --replace &";
|
if (DEBUG) {
|
||||||
|
logger.error("Cannot initialize GtkSystemTray", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ("gnome-fallback".equalsIgnoreCase(GDM)) {
|
||||||
|
try {
|
||||||
|
trayType = GtkSystemTray.class;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (DEBUG) {
|
||||||
|
logger.error("Cannot initialize GtkSystemTray", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ("ubuntu".equalsIgnoreCase(GDM)) {
|
||||||
|
// have to install the gnome extension AND customize the restart command
|
||||||
|
trayType = null;
|
||||||
|
GnomeShellExtension.SHELL_RESTART_COMMAND = "unity --replace &";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// is likely 'gnome' (gnome-shell exists on the platform), but it can also be unknown (or something completely different),
|
// is likely 'gnome' (gnome-shell exists on the platform), but it can also be unknown (or something completely different),
|
||||||
// install extension and go from there
|
// install extension and go from there
|
||||||
if (isReallyGnome) {
|
if (isReallyGnome) {
|
||||||
|
@ -407,6 +410,7 @@ class SystemTray {
|
||||||
}
|
}
|
||||||
|
|
||||||
GnomeShellExtension.install(output);
|
GnomeShellExtension.install(output);
|
||||||
|
// we might be running gnome-shell, we MIGHT NOT. If we are forced to be app-indicator or swing, don't do this.
|
||||||
if (trayType == null) {
|
if (trayType == null) {
|
||||||
trayType = GtkSystemTray.class;
|
trayType = GtkSystemTray.class;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user