Added better detection when there are incompatibilities between GTK + AppIndicator, and we cannot try to fallback to Swing (because it's not compatible)
This commit is contained in:
parent
2161f4b846
commit
ded9fca865
|
@ -681,7 +681,6 @@ class SystemTray {
|
|||
systemTray = null;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else if (Swt.isLoaded) {
|
||||
// Necessary for us to work with SWT based on version info. We can try to set us to be compatible with whatever it is set to
|
||||
|
@ -848,6 +847,9 @@ class SystemTray {
|
|||
GtkEventDispatch.startGui(FORCE_GTK2, PREFER_GTK3, DEBUG);
|
||||
GtkEventDispatch.waitForEventsToComplete();
|
||||
|
||||
|
||||
|
||||
|
||||
if (DEBUG) {
|
||||
// output what version of GTK we have loaded.
|
||||
logger.debug("GTK Version: " + Gtk.MAJOR + "." + Gtk.MINOR + "." + Gtk.MICRO);
|
||||
|
@ -865,21 +867,39 @@ class SystemTray {
|
|||
else if (OSUtil.Linux.isArch()) {
|
||||
// arch linux is fun!
|
||||
|
||||
// this will try to load AppIndicator
|
||||
if (isTrayType(trayType, TrayType.AppIndicator) && !AppIndicator.isLoaded) {
|
||||
// appindicators
|
||||
|
||||
// requires the install of libappindicator which is GTK2 (as of 25DEC2016)
|
||||
// requires the install of libappindicator3 which is GTK3 (as of 25DEC2016)
|
||||
trayType = selectTypeQuietly(TrayType.Swing);
|
||||
if (java.awt.SystemTray.isSupported()) {
|
||||
trayType = selectTypeQuietly(TrayType.Swing);
|
||||
|
||||
if (Gtk.isGtk2) {
|
||||
logger.warn("Unable to initialize AppIndicator for Arch linux, it requires GTK2! " +
|
||||
"Please install libappindicator, for example: 'sudo pacman -S libappindicator'. " +
|
||||
"Using the Swing Tray type instead.");
|
||||
} else {
|
||||
logger.error("Unable to initialize AppIndicator for Arch linux, it requires GTK3! " +
|
||||
"Please install libappindicator3, for example: 'sudo pacman -S libappindicator3'. " +
|
||||
"Using the Swing Tray type instead."); // GTK3
|
||||
if (Gtk.isGtk2) {
|
||||
logger.warn("Unable to initialize AppIndicator for Arch linux, it requires GTK2! " +
|
||||
"Please install libappindicator, for example: 'sudo pacman -S libappindicator'. " +
|
||||
"Using the Swing Tray type instead.");
|
||||
}
|
||||
else {
|
||||
logger.warn("Unable to initialize AppIndicator for Arch linux, it requires GTK3! " +
|
||||
"Please install libappindicator3, for example: 'sudo pacman -S libappindicator3'. " +
|
||||
"Using the Swing Tray type instead."); // GTK3
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Gtk.isGtk2) {
|
||||
logger.error("Unable to initialize AppIndicator for Arch linux, it requires GTK2! " +
|
||||
"Please install libappindicator, for example: 'sudo pacman -S libappindicator'. ");
|
||||
}
|
||||
else {
|
||||
logger.error("Unable to initialize AppIndicator for Arch linux, it requires GTK3! " +
|
||||
"Please install libappindicator3, for example: 'sudo pacman -S libappindicator3'. "); // GTK3
|
||||
}
|
||||
|
||||
systemTrayMenu = null;
|
||||
systemTray = null;
|
||||
return;
|
||||
}
|
||||
} else if (isTrayType(trayType, TrayType.GtkStatusIcon)) {
|
||||
if (!Extension.isInstalled()) {
|
||||
|
@ -894,18 +914,44 @@ class SystemTray {
|
|||
}
|
||||
else if (isTrayType(trayType, TrayType.AppIndicator)) {
|
||||
if (Gtk.isGtk2 && AppIndicator.isVersion3) {
|
||||
trayType = selectTypeQuietly(TrayType.Swing);
|
||||
|
||||
logger.warn("AppIndicator3 detected with GTK2, falling back to GTK2 system tray type. " +
|
||||
"Please install libappindicator1 OR GTK3, for example: 'sudo apt-get install libappindicator1'. " +
|
||||
"Using the Swing Tray type instead.");
|
||||
if (java.awt.SystemTray.isSupported()) {
|
||||
trayType = selectTypeQuietly(TrayType.Swing);
|
||||
|
||||
logger.warn("AppIndicator3 detected with GTK2, falling back to GTK2 system tray type. " +
|
||||
"Please install libappindicator1 OR GTK3, for example: 'sudo apt-get install libappindicator1'. " +
|
||||
"Using the Swing Tray type instead.");
|
||||
}
|
||||
else {
|
||||
logger.warn("AppIndicator3 detected with GTK2, falling back to GTK2 system tray type. " +
|
||||
"Please install libappindicator1 OR GTK3, for example: 'sudo apt-get install libappindicator1'.");
|
||||
|
||||
systemTrayMenu = null;
|
||||
systemTray = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!AppIndicator.isLoaded) {
|
||||
// YIKES. Try to fallback to GtkStatusIndicator, since AppIndicator couldn't load.
|
||||
trayType = selectTypeQuietly(TrayType.Swing);
|
||||
// YIKES. AppIndicator couldn't load.
|
||||
|
||||
logger.warn("Unable to initialize the AppIndicator correctly. Using the Swing Tray type instead.");
|
||||
if (java.awt.SystemTray.isSupported()) {
|
||||
trayType = selectTypeQuietly(TrayType.Swing);
|
||||
logger.warn("Unable to initialize the AppIndicator correctly. Using the Swing Tray type instead.");
|
||||
}
|
||||
else {
|
||||
if (Gtk.isGtk2) {
|
||||
logger.error("AppIndicator unable to load. " +
|
||||
"Please install libappindicator1, for example: 'sudo apt-get install libappindicator1'.");
|
||||
}
|
||||
else {
|
||||
logger.error("AppIndicator unable to load. " +
|
||||
"Please install libappindicator3, for example: 'sudo apt-get install libappindicator3-1'.");
|
||||
}
|
||||
|
||||
systemTrayMenu = null;
|
||||
systemTray = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user