Added ChromeOS detection
This commit is contained in:
parent
adbd14eaee
commit
ab8e7e5a79
@ -410,6 +410,7 @@ class OSUtil {
|
||||
XFCE,
|
||||
LXDE,
|
||||
Pantheon,
|
||||
ChromeOS,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
@ -459,12 +460,18 @@ class OSUtil {
|
||||
return Env.Gnome;
|
||||
}
|
||||
|
||||
// maybe it's chromeOS?
|
||||
if (isChromeOS()) {
|
||||
return Env.ChromeOS;
|
||||
}
|
||||
|
||||
return Env.Unknown;
|
||||
}
|
||||
|
||||
|
||||
private static volatile Boolean isGnome = null;
|
||||
private static volatile Boolean isKDE = null;
|
||||
private static volatile Boolean isChromeOS = null;
|
||||
|
||||
public static
|
||||
boolean isGnome() {
|
||||
@ -612,6 +619,37 @@ class OSUtil {
|
||||
}
|
||||
|
||||
|
||||
public static
|
||||
boolean isChromeOS() {
|
||||
if (isChromeOS == null) {
|
||||
if (!OS.isLinux()) {
|
||||
isChromeOS = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// ps aux | grep chromeos
|
||||
final ShellExecutor shellVersion = new ShellExecutor();
|
||||
shellVersion.setExecutable("ps");
|
||||
shellVersion.addArgument("aux");
|
||||
shellVersion.start();
|
||||
|
||||
String output = shellVersion.getOutput();
|
||||
|
||||
if (!output.isEmpty()) {
|
||||
if (output.contains("chromeos")) {
|
||||
isChromeOS = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return isChromeOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channel which XFCE channel to query. Cannot be null
|
||||
* @param property which property (in the channel) to query. Null will list all properties in the channel
|
||||
|
Loading…
Reference in New Issue
Block a user