Linux named notifications (#12192)
* Set name & desktop-entry on Linux notifications * DBusMock now honors verbose mode flag * Disable DBus Notification tests on ia32
This commit is contained in:
parent
9d090e00f2
commit
86af20ded0
9 changed files with 163 additions and 14 deletions
|
@ -8,12 +8,14 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_enumerator.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "brightray/browser/notification_delegate.h"
|
||||
#include "brightray/common/application_info.h"
|
||||
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
||||
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
|
||||
|
@ -126,6 +128,20 @@ void LibnotifyNotification::Show(const NotificationOptions& options) {
|
|||
notification_, "x-canonical-append", "true");
|
||||
}
|
||||
|
||||
// Send the desktop name to identify the application
|
||||
// The desktop-entry is the part before the .desktop
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
std::string desktop_id = libgtkui::GetDesktopName(env.get());
|
||||
if (!desktop_id.empty()) {
|
||||
const std::string suffix{".desktop"};
|
||||
if (base::EndsWith(desktop_id, suffix,
|
||||
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||
desktop_id.resize(desktop_id.size() - suffix.size());
|
||||
}
|
||||
libnotify_loader_.notify_notification_set_hint_string(
|
||||
notification_, "desktop-entry", desktop_id.c_str());
|
||||
}
|
||||
|
||||
GError* error = nullptr;
|
||||
libnotify_loader_.notify_notification_show(notification_, &error);
|
||||
if (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue