fix: set Wayland application ID (#34855)

* refactor: extract XDG app ID logic into a method

* fix: set application ID on Wayland
This commit is contained in:
Valentin Hăloiu 2022-07-11 21:26:18 +03:00 committed by GitHub
parent 8f3fb8db09
commit f63bba8ce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 8 deletions

View file

@ -9,7 +9,6 @@
#include "base/files/file_enumerator.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "shell/browser/notifications/notification_delegate.h"
#include "shell/browser/ui/gtk_util.h"
@ -138,13 +137,8 @@ void LibnotifyNotification::Show(const NotificationOptions& options) {
// Send the desktop name to identify the application
// The desktop-entry is the part before the .desktop
std::string desktop_id;
if (platform_util::GetDesktopName(&desktop_id)) {
const std::string suffix{".desktop"};
if (base::EndsWith(desktop_id, suffix,
base::CompareCase::INSENSITIVE_ASCII)) {
desktop_id.resize(desktop_id.size() - suffix.size());
}
std::string desktop_id = platform_util::GetXdgAppId();
if (!desktop_id.empty()) {
libnotify_loader_.notify_notification_set_hint_string(
notification_, "desktop-entry", desktop_id.c_str());
}