]> khamidou — GitHub mirrors - electron.git/commitdiff
linux: GlobalMenu: only if UBUNTU_MENUPROXY is set
authorMatthieu Baerts <matttbe@gmail.com>
Sun, 12 Oct 2014 19:16:32 +0000 (21:16 +0200)
committerMatthieu Baerts <matttbe@gmail.com>
Sun, 12 Oct 2014 19:16:32 +0000 (21:16 +0200)
When checking if we should react differently when GlobalMenu bar is
used, we should check if UBUNTU_MENUPROXY env var is (correctly) set
instead of checking if we're using Unity on a Unity session.

It's better to do that because we can use Compiz on a Unity session
without Unity. Or we can also use Unity in a different session.

atom/browser/native_window_views.cc

index 60eb70a71c5e2d428489317d2f052efb6dee133a..dde5c57f589cd50af5614b314422d41e300454a9 100644 (file)
@@ -67,9 +67,12 @@ int kWindowsCreated = 0;
 bool ShouldUseGlobalMenuBar() {
   // Some DE would pretend to be Unity but don't have global application menu,
   // so we can not trust unity::IsRunning().
+  // When Unity's GlobalMenu is running $UBUNTU_MENUPROXY should be set to
+  // something like "libappmenu.so".
   scoped_ptr<base::Environment> env(base::Environment::Create());
-  return unity::IsRunning() && (base::nix::GetDesktopEnvironment(env.get()) ==
-      base::nix::DESKTOP_ENVIRONMENT_UNITY);
+  std::string name;
+  return env && env->GetVar("UBUNTU_MENUPROXY", &name) &&
+         !name.empty() && name != "0";
 }
 #endif