-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notifications: send the desktop file name with the notification #11913
Conversation
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
|
For instance, GNOME Shell is retrieving this information here https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/ui/notificationDaemon.js#L189 |
|
||
libnotify_loader_.notify_notification_set_hint_string( | ||
notification_, "desktop-entry", desktop_id.c_str()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't looked into this before, so some breadcrumbs on why this ought to work....
libgtkui::GetDesktopName()
is implemented this way in chrome/browser/ui/libgtkui/gtk_util.cc
:
std::string GetDesktopName(base::Environment* env) {
#if defined(GOOGLE_CHROME_BUILD)
return "google-chrome.desktop";
#else // CHROMIUM_BUILD
// Allow $CHROME_DESKTOP to override the built-in value, so that development
// versions can set themselves as the default without interfering with
// non-official, packaged versions using the built-in value.
std::string name;
if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty())
return name;
return "chromium-browser.desktop";
#endif
}
and CHROME_DESKTOP
is set by Electron apps:
void App::SetDesktopName(const std::string& desktop_name) {
#if defined(OS_LINUX)
std::unique_ptr<base::Environment> env(base::Environment::Create());
env->SetVar("CHROME_DESKTOP", desktop_name);
#endif
}
And, though it's probably common knowledge to people who might be reading this 😄 , desktop-entry
is documented in this list of fdo hints at developer.gnome.org.
This specifies the name of the desktop filename representing the
calling program. This should be the same as the prefix used for the
application's .desktop file. An example would be "rhythmbox" from
"rhythmbox.desktop". This can be used by the daemon to retrieve the
correct icon for the application, for logging purposes, etc.
tl;dr: lgtm
@ckerr Your branch is right, but splitting it into smaller-scope PR might at least allow some to be merged and thus increase the probability of getting this bug fixed ;) |
Agreed, I ran short on time before the 2.0.0 freeze and wound up splitting the API breaking changes into a separate patch that didn't change the dbus traffic and so didn't need new dbus test scaffolding, and got than landed before the 2.0.0 freeze. I'll get the rest of this landed Real Soon Now. |
My notifications still are under |
I sadly haven't tested it.
It should allow any linux desktop environment to be able to know where the notification comes from and be able to categorize it in the settings and even be able to fine-tune per-app settings (play sound/show popup/keep in notification center).
How to test:
Build a linux app using notifications and test that the notification entry is present in the notification settings of the distribution (for example GNOME Control Center)