Dunst: Support for Chrome native notifications

Created on 17 Sep 2017  路  18Comments  路  Source: dunst-project/dunst

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

external

Most helpful comment

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

All 18 comments

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.

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

@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.

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.

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'].

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.

@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.

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

@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 :)

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.

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

@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.

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

@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?

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

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).

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

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahjstone picture ahjstone  路  4Comments

mrmoroshkin picture mrmoroshkin  路  4Comments

coxley picture coxley  路  4Comments

adihrustic picture adihrustic  路  3Comments

ghost picture ghost  路  5Comments