Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ It can be useful for example if you want to synchronize your GUI App's look and
> This library is inspired by the dark-theme detection in [Intellij Idea](https://github.com/JetBrains/intellij-community).

# Compatibility
It works on **Windows 10**, **MacOS Mojave** (or later) and even on **some Linux desktop environments**:

- Gnome: Fully supported and tested on Ubuntu
- KDE Plasma: Fully supported and tested on Ubuntu
It works on **Windows 10**, **MacOS Mojave** (or later) and even on **some Linux distributions**.

# Requirements
**Java 11 or higher**
Expand Down
123 changes: 0 additions & 123 deletions src/main/java/com/jthemedetecor/KdeThemeDetector.java

This file was deleted.

5 changes: 1 addition & 4 deletions src/main/java/com/jthemedetecor/OsThemeDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ private static OsThemeDetector createDetector() {
} else if (OsInfo.isGnome()) {
logDetection("Gnome", GnomeThemeDetector.class);
return new GnomeThemeDetector();
} else if (OsInfo.isKde()) {
logDetection("KDE", KdeThemeDetector.class);
return new KdeThemeDetector();
} else if (OsInfo.isMacOsMojaveOrLater()) {
logDetection("MacOS", MacOSThemeDetector.class);
return new MacOSThemeDetector();
Expand Down Expand Up @@ -105,7 +102,7 @@ private static void logDetection(String desktop, Class<? extends OsThemeDetector

@ThreadSafe
public static boolean isSupported() {
return OsInfo.isWindows10OrLater() || OsInfo.isMacOsMojaveOrLater() || OsInfo.isGnome() || OsInfo.isKde();
return OsInfo.isWindows10OrLater() || OsInfo.isMacOsMojaveOrLater() || OsInfo.isGnome();
}

private static final class EmptyDetector extends OsThemeDetector {
Expand Down
15 changes: 5 additions & 10 deletions src/main/java/com/jthemedetecor/util/OsInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ public static boolean isMacOsMojaveOrLater() {
return hasTypeAndVersionOrHigher(PlatformEnum.MACOS, "10.14");
}

@NotNull
public static String getCurrentLinuxDesktopEnvironmentName() {
return System.getenv("XDG_CURRENT_DESKTOP");
}

public static boolean isGnome() {
return isLinux() && getCurrentLinuxDesktopEnvironmentName().toLowerCase().contains("gnome");
}

public static boolean isKde() {
return isLinux() && getCurrentLinuxDesktopEnvironmentName().toLowerCase().contains("KDE".toLowerCase());
return isLinux() && (
queryResultContains("echo $XDG_CURRENT_DESKTOP", "gnome") ||
queryResultContains("echo $XDG_DATA_DIRS | grep -Eo 'gnome'", "gnome") ||
queryResultContains("ps -e | grep -E -i \"gnome\"", "gnome")
);
}

public static boolean hasType(PlatformEnum platformType) {
Expand Down