Skip to content
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

Support for Chrome native notifications #375

Closed
JesseFarebro opened this issue Sep 17, 2017 · 18 comments
Closed

Support for Chrome native notifications #375

JesseFarebro opened this issue Sep 17, 2017 · 18 comments
Labels

Comments

@JesseFarebro
Copy link

Just wanted to get a discussion going to see what kind of work would be needed to support Chrome's native notifications. It seems dunst supports most of the capabilities Chrome needs but dunst is still being blacklisted in Chrome.

More discussion can be seen here: https://bugs.chromium.org/p/chromium/issues/detail?id=676220

@bebehei
Copy link
Member

bebehei commented Sep 18, 2017

I'd guess chromium behaves the same and I tested it yesterday on chromium:

In general a notification server can support "capabilites". In the thread there said, that action and action-icons is required. But even after pretending, that dunst supports action-icons, chromium does not send the notifications to dunst. Chromium also does not query the capabilites.

Only forcing chromium helps doing this.

@tsipinakis
Copy link
Member

Hm, from what I see in the source the only capabilities required are body and action

@bebehei
Copy link
Member

bebehei commented Sep 18, 2017

@tsipinakis dbus-monitor path=/org/freedesktop/Notifications doesn't even show any activity when launching a notification.

Maybe @hobarrera can tell you more he participated in the thread.

@WhyNotHugo
Copy link
Contributor

Sorry, there's not much more that I can add.

The patch that does the blacklisting itself is here. My C++ isn't good enough to follow through, but maybe you can find something relevant.

@WhyNotHugo
Copy link
Contributor

WhyNotHugo commented Sep 18, 2017

Actually, it seems the GetCapabilities call is done when launching chrome, not when showing a notification:

$ dbus-monitor path=/org/freedesktop/Notifications                                            
signal time=1505773000.276594 sender=org.freedesktop.DBus -> destination=:1.1082 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.1082"                            
signal time=1505773000.276608 sender=org.freedesktop.DBus -> destination=:1.1082 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.1082"                            
method call time=1505773003.220341 sender=:1.1086 -> destination=org.freedesktop.Notifications serial=3 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=GetCapabilities

The latest stable release of dunst returns this: ['actions', 'body', 'body-hyperlinks', 'body-markup'].

@tadly
Copy link

tadly commented Sep 20, 2017

Wait, so you guys are saying that notifications posted by chrome should not be display via dunst?
Because they do for me.

The two entries starting with # are actions and do nothing at all.
Also, the icon is always the generic info icon.

2017-09-20-091531_1920x1080_scrot

p.s. that's chrome 61 but has been working every since google introduced native notifications on linux.

@tsipinakis
Copy link
Member

@JesseFarebro What version are you running can you verify that you're using one that supports native notifications?

@tadly Can you provide a dbus-monitor dump starting with closed chrome and receiving a notification? Just to have an idea on how chrome behaves from launch to notification sending and actions.

The icon thing may be related to #339 if you're on the latest stable.

@bebehei
Copy link
Member

bebehei commented Sep 20, 2017

@tadly could you also please provide the setting of the flag chrome://flags/#enable-native-notifications?

@tadly
Copy link

tadly commented Sep 20, 2017

@tsipinakis if you tell me how to, sure. Never used any of the dbus tools nor did I ever work with dbus itself. Would save me a lot of time :)

Also, icons do generally work. Chrome is the only one I've noticed it not doing so (I don't get a whole lot of notifications on linux though)

@bebehei chrome://flags/#enable-native-notifications is enabled. I remember doing that now that you mention it :)

@tsipinakis
Copy link
Member

if you tell me how to, sure

Just close chrome entirely, run dbus-monitor in a terminal and then open chrome and send a notification from it.

@tadly
Copy link

tadly commented Sep 20, 2017

@tsipinakis Didn't know where else to put it but here you go... https://pastebin.com/uS6bJn4q

@bebehei
Copy link
Member

bebehei commented Sep 20, 2017

@bebehei chrome://flags/#enable-native-notifications is enabled. I remember doing that now that you mention it :)

So that's the reason for it. Can you please test, that "default" does not show notifications?

@tsipinakis For me, this looks like an implementation bug of chrome. dunst provides all required caps and it looks like chrome behaves wrong in its "default" behavior.

@tadly
Copy link

tadly commented Sep 20, 2017

@bebehei Can confirm. Setting it back to default gives me chromes notifications again.

@JesseFarebro
Copy link
Author

@tsipinakis Running Chrome 61, latest version. I do have #enable-native-notifications enabled and when I run dbus-monitor while launching chrome there are no queries to dbus for notification capabilities at all. Running latest dunst from master and verified notify-send works as expected with the correct dbus queries.

Anything else you can suggest?

@maximbaz
Copy link

maximbaz commented Nov 11, 2017

it looks like chrome behaves wrong in its "default" behavior.

Comment from the sources of the last stable chromium:

// Selection of the implementation works as follows:
//   - Android always uses the NativeNotificationDisplayService.
//   - Mac uses the NativeNotificationDisplayService by default but
//     can revert to MessageCenterDisplayService via
//     chrome://flags#enable-native-notifications or Finch
//   - Linux uses MessageCenterDisplayService by default but can switch
//     to NativeNotificationDisplayService via
//     chrome://flags#enable-native-notifications
//   - All other platforms always use the MessageCenterDisplayService.

So as you can see this behavior is intentional, while Mac uses native notifications for "Default", Linux does not and requires the flag 😞.


The icon thing may be related to #339 if you're on the latest stable.

On the latest master the icon is still not showing when notification is sent by chromium (e.g. by this website). As it was mentioned, images are present when notifications are sent by other apps, so it must be something to do specifically with chromium.


@JesseFarebro I noticed that if I run chromium --enable-native-notifications then native notifications are not enabled, but if set #enable-native-notifications to Enabled in chrome://flags, then native notifications start working. Not sure why, other flags seem to be working even when passed as CLI argument. Try different ways to set the flag, maybe one of them will work for you.

UPDATE: I discovered that this is the right way to enable this flag via CLI arguments: chromium --enable-features=NativeNotifications

@slokhorst
Copy link

slokhorst commented Dec 7, 2017

The flag has been enabled by default and will ship in Chromium 64.

The notification shows the generic Chrome icon when using 64.0.3278.0 (dev channel).

@slokhorst
Copy link

slokhorst commented Dec 7, 2017

Oops, my bad! With the current Dunst master it even shows the custom notification icon. (was using 1.2.0 before) Everything works perfectly!

2017-12-07-134321_708x319_scrot

@bebehei
Copy link
Member

bebehei commented Dec 7, 2017

@slokhorst Thanks for notifying us. As the feature is now shipping downards the stream and will released at the end of January, I'll close this issue.

The missing icons probably are related to #447. I can say for sure, that a new dunst release is shipped out before chromium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants