Cleaned up KDE plasma type detection. Fixed swing fallback for KDE

This commit is contained in:
nathan 2018-11-03 15:19:43 +01:00
parent 223ee50adb
commit 48a28909e5

View File

@ -379,16 +379,30 @@ class SystemTray {
return selectTypeQuietly(TrayType.GtkStatusIcon); return selectTypeQuietly(TrayType.GtkStatusIcon);
} }
case KDE: { case KDE: {
if (OSUtil.Linux.isFedora()) { // kde 5.8+ is "high DPI", so we need to adjust the scale. Image resize will do that
// Fedora KDE requires GtkStatusIcon
return selectTypeQuietly(TrayType.GtkStatusIcon); double plasmaVersion = DesktopEnv.getPlasmaVersion();
}
else { if (DEBUG) {
// kde (at least, plasma 5.5.6) requires appindicator logger.debug("KDE Plasma Version: {}", plasmaVersion);
return selectTypeQuietly(TrayType.AppIndicator);
} }
// kde 5.8+ is "high DPI", so we need to adjust the scale. Image resize will do that if (plasmaVersion == 0.0) {
// this shouldn't ever happen!
logger.error("KDE Plasma detected, but UNDEFINED shell version. This should never happen. Falling back to GtkStatusIcon. " +
"Please create an issue with as many details as possible.");
return selectTypeQuietly(TrayType.GtkStatusIcon);
}
if (plasmaVersion <= 5.5) {
// older versions use GtkStatusIcon
return selectTypeQuietly(TrayType.GtkStatusIcon);
} else {
// newer versions use appindicator, but the user MIGHT have to install libappindicator
return selectTypeQuietly(TrayType.AppIndicator);
}
} }
case Unity: { case Unity: {
// Ubuntu Unity is a weird combination. It's "Gnome", but it's not "Gnome Shell". // Ubuntu Unity is a weird combination. It's "Gnome", but it's not "Gnome Shell".
@ -409,6 +423,9 @@ class SystemTray {
case LXDE: { case LXDE: {
return selectTypeQuietly(TrayType.GtkStatusIcon); return selectTypeQuietly(TrayType.GtkStatusIcon);
} }
case MATE: {
return selectTypeQuietly(TrayType.GtkStatusIcon);
}
case Pantheon: { case Pantheon: {
// elementaryOS. It only supports appindicator (not gtkstatusicon) // elementaryOS. It only supports appindicator (not gtkstatusicon)
// http://bazaar.launchpad.net/~wingpanel-devs/wingpanel/trunk/view/head:/sample/SampleIndicator.vala // http://bazaar.launchpad.net/~wingpanel-devs/wingpanel/trunk/view/head:/sample/SampleIndicator.vala
@ -932,8 +949,8 @@ class SystemTray {
if (!AppIndicator.isLoaded) { if (!AppIndicator.isLoaded) {
// YIKES. AppIndicator couldn't load. // YIKES. AppIndicator couldn't load.
// can we fallback to swing? // can we fallback to swing? KDE does not work for this...
if (AUTO_FIX_INCONSISTENCIES && java.awt.SystemTray.isSupported()) { if (AUTO_FIX_INCONSISTENCIES && java.awt.SystemTray.isSupported() && !OSUtil.DesktopEnv.isKDE()) {
trayType = selectTypeQuietly(TrayType.Swing); trayType = selectTypeQuietly(TrayType.Swing);
logger.warn("Unable to initialize the AppIndicator correctly. Using the Swing Tray type instead."); logger.warn("Unable to initialize the AppIndicator correctly. Using the Swing Tray type instead.");