#include "ui/strings/grit/ui_strings.h"
#include "ui/views/widget/widget.h"
+#if defined(OS_LINUX)
+#include "base/environment.h"
+#include "base/nix/xdg_util.h"
+#endif
+
namespace {
// Tray constants
return rb.GetImageSkiaNamed(resource_id);
}
+bool CanDestroyStatusIcon() {
+#if defined(OS_LINUX)
+ // Avoid creating multiple system tray icons on KDE4 and newer versions of KDE
+ // because the OS does not support removing system tray icons.
+ // TODO(pkotwicz): This is a hack for the sake of M40. Fix this properly.
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ base::nix::DesktopEnvironment desktop_environment =
+ base::nix::GetDesktopEnvironment(env.get());
+ return desktop_environment != base::nix::DESKTOP_ENVIRONMENT_KDE4;
+#else
+ return true;
+#endif
+}
+
} // namespace
namespace message_center {
tool_tip = l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_TOOLTIP);
}
- if (message_center()->GetVisibleNotifications().empty()) {
+ if (message_center()->GetVisibleNotifications().empty() &&
+ CanDestroyStatusIcon()) {
DestroyStatusIcon();
return;
}