Fixed system tray for fedora 24
This commit is contained in:
parent
91c401e389
commit
c48759725e
@ -535,8 +535,11 @@ class SystemTray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (trayType == null) {
|
if (trayType == null) {
|
||||||
|
// set a property so that Image Resize can adjust
|
||||||
|
System.setProperty("SystemTray_IS_FEDORA_ADJUST_SIZE", Integer.toString(fedoraVersion));
|
||||||
|
|
||||||
if (fedoraVersion <= 24) {
|
if (fedoraVersion <= 24) {
|
||||||
// 23 is gtk, 24 is ?
|
// 23 is gtk, 24 is gtk (but wrong size unless we adjust it)
|
||||||
Extension.install();
|
Extension.install();
|
||||||
trayType = selectTypeQuietly(useNativeMenus, TrayType.GtkStatusIcon);
|
trayType = selectTypeQuietly(useNativeMenus, TrayType.GtkStatusIcon);
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,8 +66,8 @@ class ImageUtils {
|
|||||||
|
|
||||||
public static
|
public static
|
||||||
void determineIconSize() {
|
void determineIconSize() {
|
||||||
int trayScalingFactor = 0;
|
double trayScalingFactor = 0;
|
||||||
int menuScalingFactor = 0;
|
double menuScalingFactor = 0;
|
||||||
|
|
||||||
if (SystemTray.AUTO_TRAY_SIZE) {
|
if (SystemTray.AUTO_TRAY_SIZE) {
|
||||||
if (OS.isWindows()) {
|
if (OS.isWindows()) {
|
||||||
@ -187,7 +187,7 @@ class ImageUtils {
|
|||||||
// KDE is bonkers. Gnome is "ok"
|
// KDE is bonkers. Gnome is "ok"
|
||||||
String XDG = System.getenv("XDG_CURRENT_DESKTOP");
|
String XDG = System.getenv("XDG_CURRENT_DESKTOP");
|
||||||
if (XDG == null) {
|
if (XDG == null) {
|
||||||
// we might be root. Check if plasmashell is running, if it is -- then we are most likely KDE
|
// Check if plasmashell is running, if it is -- then we are most likely KDE
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(8196);
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(8196);
|
||||||
@ -302,6 +302,16 @@ class ImageUtils {
|
|||||||
SystemTray.logger.error("Cannot check scaling factor", e);
|
SystemTray.logger.error("Cannot check scaling factor", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fedora 24 has a wonky size for the indicator (NOT default 16px)
|
||||||
|
int fedoraVersion = Integer.parseInt(System.getProperty("SystemTray_IS_FEDORA_ADJUST_SIZE", "0"));
|
||||||
|
if (trayScalingFactor == 0 && fedoraVersion >= 23) {
|
||||||
|
if (SystemTray.DEBUG) {
|
||||||
|
SystemTray.logger.debug("Adjusting tray/menu scaling for FEDORA " + fedoraVersion);
|
||||||
|
}
|
||||||
|
trayScalingFactor = 2;
|
||||||
|
menuScalingFactor = 1.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (OS.isMacOsX()) {
|
} else if (OS.isMacOsX()) {
|
||||||
// let's hope this wasn't just hardcoded like windows...
|
// let's hope this wasn't just hardcoded like windows...
|
||||||
@ -348,19 +358,20 @@ class ImageUtils {
|
|||||||
|
|
||||||
// the DEFAULT scale is 16
|
// the DEFAULT scale is 16
|
||||||
if (trayScalingFactor > 1) {
|
if (trayScalingFactor > 1) {
|
||||||
TRAY_SIZE = SystemTray.DEFAULT_TRAY_SIZE * trayScalingFactor;
|
TRAY_SIZE = (int) (SystemTray.DEFAULT_TRAY_SIZE * trayScalingFactor);
|
||||||
} else {
|
} else {
|
||||||
TRAY_SIZE = SystemTray.DEFAULT_TRAY_SIZE;
|
TRAY_SIZE = SystemTray.DEFAULT_TRAY_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuScalingFactor > 1) {
|
if (menuScalingFactor > 1) {
|
||||||
ENTRY_SIZE = SystemTray.DEFAULT_MENU_SIZE * menuScalingFactor;
|
ENTRY_SIZE = (int) (SystemTray.DEFAULT_MENU_SIZE * menuScalingFactor);
|
||||||
}
|
} else {
|
||||||
ENTRY_SIZE = SystemTray.DEFAULT_MENU_SIZE;
|
ENTRY_SIZE = SystemTray.DEFAULT_MENU_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.debug("Scaling Factor factor is '{}', tray size is '{}'.", trayScalingFactor, TRAY_SIZE);
|
SystemTray.logger.debug("Scaling Factor factor is '{}', tray icon size is '{}'.", trayScalingFactor, TRAY_SIZE);
|
||||||
SystemTray.logger.debug("Scaling Factor factor is '{}', tray size is '{}'.", menuScalingFactor, ENTRY_SIZE);
|
SystemTray.logger.debug("Scaling Factor factor is '{}', tray menu size is '{}'.", menuScalingFactor, ENTRY_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user