Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: base/nix/xdg_util.cc

Issue 10735034: Linux: Detect Unity as a desktop environment. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add a comment Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/nix/xdg_util.cc
===================================================================
--- base/nix/xdg_util.cc (revision 146030)
+++ base/nix/xdg_util.cc (working copy)
@@ -48,6 +48,18 @@
}
DesktopEnvironment GetDesktopEnvironment(Environment* env) {
+ // XDG_CURRENT_DESKTOP is the newest standard circa 2012.
+ 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") {
+ return DESKTOP_ENVIRONMENT_UNITY;
+ } else if (xdg_current_desktop == "GNOME") {
+ return DESKTOP_ENVIRONMENT_GNOME;
+ }
Mike Mammarella 2012/07/12 01:15:55 Looks like in this file we leave these {} off when
Lei Zhang 2012/07/12 02:27:02 Done.
+ }
+
+ // DESKTOP_SESSION was what everyone used in 2010.
std::string desktop_session;
if (env->GetVar("DESKTOP_SESSION", &desktop_session)) {
if (desktop_session == "gnome") {
@@ -88,6 +100,8 @@
return "KDE3";
case DESKTOP_ENVIRONMENT_KDE4:
return "KDE4";
+ case DESKTOP_ENVIRONMENT_UNITY:
+ return "UNITY";
case DESKTOP_ENVIRONMENT_XFCE:
return "XFCE";
}

Powered by Google App Engine
This is Rietveld 408576698