diff --git a/src/dorkbox/systemTray/SystemTray.java b/src/dorkbox/systemTray/SystemTray.java index ae5e604..5acd2ef 100644 --- a/src/dorkbox/systemTray/SystemTray.java +++ b/src/dorkbox/systemTray/SystemTray.java @@ -57,6 +57,7 @@ import dorkbox.systemTray.util.SystemTrayFixes; import dorkbox.util.CacheUtil; import dorkbox.util.IO; import dorkbox.util.OS; +import dorkbox.util.OsUtil; import dorkbox.util.Property; import dorkbox.util.SwingUtil; import dorkbox.util.process.ShellProcessBuilder; @@ -445,7 +446,7 @@ class SystemTray { // BLEH. if gnome-shell is running, IT'S REALLY GNOME! // we must ALWAYS do this check!! - boolean isReallyGnome = OS.isGnome(); + boolean isReallyGnome = OsUtil.Linux.DesktopEnv.isGnome(); if (isReallyGnome) { if (DEBUG) { @@ -475,7 +476,7 @@ class SystemTray { trayType = selectTypeQuietly(useNativeMenus, TrayType.GtkStatusIcon); } else if ("kde".equalsIgnoreCase(XDG)) { - if (OS.getFedoraVersion() > 0) { + if (OsUtil.Linux.isFedora()) { // Fedora KDE requires GtkStatusIcon trayType = selectTypeQuietly(useNativeMenus, TrayType.GtkStatusIcon); } else { @@ -490,7 +491,7 @@ class SystemTray { // http://bazaar.launchpad.net/~wingpanel-devs/wingpanel/trunk/view/head:/sample/SampleIndicator.vala if (!useNativeMenus && AUTO_FIX_INCONSISTENCIES) { - if (OS.isElementaryOS()) { + if (OsUtil.Linux.isElementaryOS()) { } else { logger.warn("Cannot use non-native menus with pantheon DE. Forcing native menus."); } @@ -510,7 +511,7 @@ class SystemTray { } if ("gnome".equalsIgnoreCase(GDM)) { - if (OS.isArch()) { + if (OsUtil.Linux.isArch()) { if (DEBUG) { logger.debug("Running Arch Linux."); } @@ -526,16 +527,12 @@ class SystemTray { } // are we fedora? If so, what version? - // now, what VERSION of fedora? 23/24/25 don't have AppIndicator installed, so we have to use GtkStatusIcon - int fedoraVersion = OS.getFedoraVersion(); - if (fedoraVersion > 0) { + // now, what VERSION of fedora? 23/24/25/? don't have AppIndicator installed, so we have to use GtkStatusIcon + if (OsUtil.Linux.isFedora()) { if (DEBUG) { - logger.debug("Running Fedora version: '{}'", fedoraVersion); + logger.debug("Running Fedora"); } - // set a property so that Image Resize can adjust. It will check the version info to determine scaling value - System.setProperty("SystemTray_IS_FEDORA_GNOME_ADJUST_SIZE", Integer.toString(fedoraVersion)); - // 23 is gtk, 24/25 is gtk (but also wrong size unless we adjust it) trayType = selectTypeQuietly(useNativeMenus, TrayType.GtkStatusIcon); } else { @@ -703,7 +700,7 @@ class SystemTray { } - if (OS.isArch()) { + if (OsUtil.Linux.isArch()) { // arch linux is fun! if (isTrayType(trayType, TrayType.AppIndicator)) { diff --git a/src/dorkbox/systemTray/gnomeShell/Extension.java b/src/dorkbox/systemTray/gnomeShell/Extension.java index ab0fc0a..365680c 100644 --- a/src/dorkbox/systemTray/gnomeShell/Extension.java +++ b/src/dorkbox/systemTray/gnomeShell/Extension.java @@ -35,7 +35,7 @@ import java.util.List; import dorkbox.systemTray.SystemTray; import dorkbox.util.IO; -import dorkbox.util.OS; +import dorkbox.util.OsUtil; import dorkbox.util.Property; import dorkbox.util.process.ShellProcessBuilder; @@ -214,7 +214,7 @@ class Extension { */ public static void install() { - if (!ENABLE_EXTENSION_INSTALL || !OS.isGnome()) { + if (!ENABLE_EXTENSION_INSTALL || !OsUtil.Linux.DesktopEnv.isGnome()) { return; } @@ -222,7 +222,7 @@ class Extension { boolean hasSystemTray; // should just be 3.14.1 or 3.20 or similar - String gnomeVersion = OS.getGnomeVersion(); + String gnomeVersion = OsUtil.Linux.DesktopEnv.getGnomeVersion(); if (gnomeVersion == null) { return; } @@ -382,7 +382,7 @@ class Extension { public static void unInstall() { - if (!ENABLE_EXTENSION_INSTALL || !OS.isGnome()) { + if (!ENABLE_EXTENSION_INSTALL || !OsUtil.Linux.DesktopEnv.isGnome()) { return; } diff --git a/src/dorkbox/systemTray/util/ImageUtils.java b/src/dorkbox/systemTray/util/ImageUtils.java index 2be1ae7..961dd51 100644 --- a/src/dorkbox/systemTray/util/ImageUtils.java +++ b/src/dorkbox/systemTray/util/ImageUtils.java @@ -51,6 +51,7 @@ import dorkbox.util.FileUtil; import dorkbox.util.IO; import dorkbox.util.LocationResolver; import dorkbox.util.OS; +import dorkbox.util.OsUtil; import dorkbox.util.SwingUtil; import dorkbox.util.process.ShellProcessBuilder; @@ -72,7 +73,7 @@ class ImageUtils { if (SystemTray.AUTO_TRAY_SIZE) { if (OS.isWindows()) { - int[] version = OS.getWindowsVersion(); + int[] version = OsUtil.Windows.getVersion(); // if windows 8.1/10 - default size is x2 @@ -154,14 +155,14 @@ class ImageUtils { String XDG = System.getenv("XDG_CURRENT_DESKTOP"); if (XDG == null) { // Check if plasmashell is running, if it is -- then we are most likely KDE - double plasmaVersion = OS.getPlasmaVersion(); + double plasmaVersion = OsUtil.Linux.DesktopEnv.getPlasmaVersion(); if (plasmaVersion > 0) { XDG = "kde"; } } if ("kde".equalsIgnoreCase(XDG)) { - double plasmaVersion = OS.getPlasmaVersion(); + double plasmaVersion = OsUtil.Linux.DesktopEnv.getPlasmaVersion(); // 1 = 16 // 2 = 32 @@ -220,8 +221,8 @@ class ImageUtils { } } - // fedora 24+ has a different size for the indicator (NOT default 16px) - int fedoraVersion = Integer.parseInt(System.getProperty("SystemTray_IS_FEDORA_GNOME_ADJUST_SIZE", "0")); + // fedora 23+ has a different size for the indicator (NOT default 16px) + int fedoraVersion = OsUtil.Linux.getFedoraVersion(); if (trayScalingFactor == 0 && fedoraVersion >= 23) { if (SystemTray.DEBUG) { SystemTray.logger.debug("Adjusting tray/menu scaling for FEDORA " + fedoraVersion);