Commit 0f4b476f authored by joleksy's avatar joleksy Committed by Commit bot

Do not rely on XDG_CURRENT_DESKTOP only when testing for Unity.

gnome-fallback sessions set XDG_CURRENT_DESKTOP to Unity,
DESKTOP_SESSION needs to be tested as well.

BUG=

Review URL: https://codereview.chromium.org/550173006

Cr-Commit-Position: refs/heads/master@{#294381}
parent a54214a5
......@@ -57,10 +57,18 @@ DesktopEnvironment GetDesktopEnvironment(Environment* env) {
std::string xdg_current_desktop;
if (env->GetVar("XDG_CURRENT_DESKTOP", &xdg_current_desktop)) {
// Not all desktop environments set this env var as of this writing.
if (xdg_current_desktop == "Unity")
if (xdg_current_desktop == "Unity") {
// gnome-fallback sessions set XDG_CURRENT_DESKTOP to Unity
// DESKTOP_SESSION can be gnome-fallback or gnome-fallback-compiz
std::string desktop_session;
if (env->GetVar("DESKTOP_SESSION", &desktop_session) &&
desktop_session.find("gnome-fallback") != std::string::npos) {
return DESKTOP_ENVIRONMENT_GNOME;
}
return DESKTOP_ENVIRONMENT_UNITY;
else if (xdg_current_desktop == "GNOME")
} else if (xdg_current_desktop == "GNOME") {
return DESKTOP_ENVIRONMENT_GNOME;
}
}
// DESKTOP_SESSION was what everyone used in 2010.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment