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;
|
systemTray = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (Swt.isLoaded) {
|
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
|
// 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.startGui(FORCE_GTK2, PREFER_GTK3, DEBUG);
|
||||||
GtkEventDispatch.waitForEventsToComplete();
|
GtkEventDispatch.waitForEventsToComplete();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
// output what version of GTK we have loaded.
|
// output what version of GTK we have loaded.
|
||||||
logger.debug("GTK Version: " + Gtk.MAJOR + "." + Gtk.MINOR + "." + Gtk.MICRO);
|
logger.debug("GTK Version: " + Gtk.MAJOR + "." + Gtk.MINOR + "." + Gtk.MICRO);
|
||||||
|
@ -865,22 +867,40 @@ class SystemTray {
|
||||||
else if (OSUtil.Linux.isArch()) {
|
else if (OSUtil.Linux.isArch()) {
|
||||||
// arch linux is fun!
|
// arch linux is fun!
|
||||||
|
|
||||||
|
// this will try to load AppIndicator
|
||||||
if (isTrayType(trayType, TrayType.AppIndicator) && !AppIndicator.isLoaded) {
|
if (isTrayType(trayType, TrayType.AppIndicator) && !AppIndicator.isLoaded) {
|
||||||
// appindicators
|
// appindicators
|
||||||
|
|
||||||
// requires the install of libappindicator which is GTK2 (as of 25DEC2016)
|
// requires the install of libappindicator which is GTK2 (as of 25DEC2016)
|
||||||
// requires the install of libappindicator3 which is GTK3 (as of 25DEC2016)
|
// requires the install of libappindicator3 which is GTK3 (as of 25DEC2016)
|
||||||
|
if (java.awt.SystemTray.isSupported()) {
|
||||||
trayType = selectTypeQuietly(TrayType.Swing);
|
trayType = selectTypeQuietly(TrayType.Swing);
|
||||||
|
|
||||||
if (Gtk.isGtk2) {
|
if (Gtk.isGtk2) {
|
||||||
logger.warn("Unable to initialize AppIndicator for Arch linux, it requires GTK2! " +
|
logger.warn("Unable to initialize AppIndicator for Arch linux, it requires GTK2! " +
|
||||||
"Please install libappindicator, for example: 'sudo pacman -S libappindicator'. " +
|
"Please install libappindicator, for example: 'sudo pacman -S libappindicator'. " +
|
||||||
"Using the Swing Tray type instead.");
|
"Using the Swing Tray type instead.");
|
||||||
} else {
|
}
|
||||||
logger.error("Unable to initialize AppIndicator for Arch linux, it requires GTK3! " +
|
else {
|
||||||
|
logger.warn("Unable to initialize AppIndicator for Arch linux, it requires GTK3! " +
|
||||||
"Please install libappindicator3, for example: 'sudo pacman -S libappindicator3'. " +
|
"Please install libappindicator3, for example: 'sudo pacman -S libappindicator3'. " +
|
||||||
"Using the Swing Tray type instead."); // GTK3
|
"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)) {
|
} else if (isTrayType(trayType, TrayType.GtkStatusIcon)) {
|
||||||
if (!Extension.isInstalled()) {
|
if (!Extension.isInstalled()) {
|
||||||
// Automatically install the extension for everyone except Arch. They are bonkers.
|
// Automatically install the extension for everyone except Arch. They are bonkers.
|
||||||
|
@ -894,19 +914,45 @@ class SystemTray {
|
||||||
}
|
}
|
||||||
else if (isTrayType(trayType, TrayType.AppIndicator)) {
|
else if (isTrayType(trayType, TrayType.AppIndicator)) {
|
||||||
if (Gtk.isGtk2 && AppIndicator.isVersion3) {
|
if (Gtk.isGtk2 && AppIndicator.isVersion3) {
|
||||||
|
|
||||||
|
if (java.awt.SystemTray.isSupported()) {
|
||||||
trayType = selectTypeQuietly(TrayType.Swing);
|
trayType = selectTypeQuietly(TrayType.Swing);
|
||||||
|
|
||||||
logger.warn("AppIndicator3 detected with GTK2, falling back to GTK2 system tray type. " +
|
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'. " +
|
"Please install libappindicator1 OR GTK3, for example: 'sudo apt-get install libappindicator1'. " +
|
||||||
"Using the Swing Tray type instead.");
|
"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) {
|
else if (!AppIndicator.isLoaded) {
|
||||||
// YIKES. Try to fallback to GtkStatusIndicator, since AppIndicator couldn't load.
|
// YIKES. AppIndicator couldn't load.
|
||||||
trayType = selectTypeQuietly(TrayType.Swing);
|
|
||||||
|
|
||||||
|
if (java.awt.SystemTray.isSupported()) {
|
||||||
|
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.");
|
||||||
}
|
}
|
||||||
|
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