diff --git a/BUILD.gn b/BUILD.gn index 8afb3b064e27..3a44e7aabcb7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -76,6 +76,7 @@ if (is_linux) { "notify_notification_set_timeout", "notify_notification_set_urgency", "notify_notification_set_hint_string", + "notify_notification_set_hint", "notify_notification_show", "notify_notification_close", ] diff --git a/shell/browser/notifications/linux/libnotify_notification.cc b/shell/browser/notifications/linux/libnotify_notification.cc index 4c8452fad1a8..4b6c6cf89776 100644 --- a/shell/browser/notifications/linux/libnotify_notification.cc +++ b/shell/browser/notifications/linux/libnotify_notification.cc @@ -10,6 +10,7 @@ #include "base/files/file_enumerator.h" #include "base/functional/bind.h" #include "base/logging.h" +#include "base/process/process_handle.h" #include "base/strings/utf_string_conversions.h" #include "shell/browser/notifications/notification_delegate.h" #include "shell/browser/ui/gtk_util.h" @@ -145,6 +146,10 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { notification_, "desktop-entry", desktop_id.c_str()); } + libnotify_loader_.notify_notification_set_hint( + notification_, "sender-pid", + g_variant_new_int64(base::GetCurrentProcId())); + GError* error = nullptr; libnotify_loader_.notify_notification_show(notification_, &error); if (error) { diff --git a/spec/api-notification-dbus-spec.ts b/spec/api-notification-dbus-spec.ts index 26e50e9bf3ae..2246cefb2dea 100644 --- a/spec/api-notification-dbus-spec.ts +++ b/spec/api-notification-dbus-spec.ts @@ -118,6 +118,7 @@ ifdescribe(!skip)('Notification module (dbus)', () => { hints: { append: 'true', 'desktop-entry': appName, + 'sender-pid': process.pid, urgency: 1 } });