Nw.js: Remove settings button from native notifications on Linux

Created on 7 Oct 2017  路  9Comments  路  Source: nwjs/nw.js

Hi, I hope this is the right issue tracker for issues regarding nwjs' chromium.src repo...

In #4560, you said you wanted to wait for Chromium to implement native notifications on all platforms instead of re-adding the functionality back to 0.13. Chromium has now finally implemented native notifications on Linux after doing so on macOS a few months ago:

  • Linux: Chromium 61 / NWjs 0.25 (https://crbug.com/676220)
  • macOS: Chromium 54 / NWjs 0.18 (I think it got removed from the --enable-features=NativeNotifications feature flag in Chromium 59 / NWjs 0.23) (https://crbug.com/326539)
  • Windows: still unsupported (https://crbug.com/516147)

Now to the issue:
Native notifications created by Chromium on both macOS and Linux always include a "Settings" action button. In NWjs, clicking this settings button opens a new window with a blank site. This behavior can't be changed or disabled, because it is hardcoded and it is super annoying. Especially since notifications with and without actions can be displayed completely differently on the system. And having such a settings button is confusing for the end user.

On macOS, you've already disabled the behavior in NWjs 0.25:

On Linux, this is still enabled and needs a fix:

Thanks for your consideration!

needinfo

Most helpful comment

This is fixed in git and will be available in the next nightly build.

All 9 comments

Could you please show some sample to trigger it? I tried some from chrome app notification sample but it doesn't show any settings button under Linux...

When using the window.Notification API, the settings action will be added to the dbus call on Linux (it doesn't show the settings button on macOS, as it got removed in the linked commit-id above)

new window.Notification( "foo", {
  message: "bar",
  actions: []
});

The window.chrome.notifications API doesn't add a settings button either on Linux or on macOS. I was using this API for showing rich notifications on Windows 7 and wasn't aware of the difference in behavior on Linux after the recent changes.

window.chrome.notifications.create( "id", {
  type: "basic",
  title: "foo",
  message: "bar",
  iconUrl: "file:///path/to/icon"
})

(remember to set the --enable-features=NativeNotifications chromium parameter)

I don't see any settings button with window.Notification and --enable-features=NativeNotifications. maybe it's added by your linux desktop environment?
screen sharing picture 24 october 2017 at 2 14 20 pm gmt 8

CC @Christywl can you verify?

No, NWjs adds the settings button and reacts to clicks with opening the blank Chromium settings window.
Run this to monitor the freedesktop notifications dbus interface:

$ gdbus monitor --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications
Monitoring signals on object /org/freedesktop/Notifications owned by org.freedesktop.Notifications
The name org.freedesktop.Notifications is owned by :1.60
/org/freedesktop/Notifications: org.freedesktop.Notifications.ActionInvoked (uint32 171, 'default')
/org/freedesktop/Notifications: org.freedesktop.Notifications.NotificationClosed (uint32 171, uint32 2)
/org/freedesktop/Notifications: org.freedesktop.Notifications.ActionInvoked (uint32 172, 'settings')
/org/freedesktop/Notifications: org.freedesktop.Notifications.NotificationClosed (uint32 172, uint32 2)
^C
// normal click here
new Notification( "foo", { message: "bar", actions: [] } );
// settings click here
new Notification( "foo", { message: "bar", actions: [] } );

@rogerwang
The screenshot you've posted seems to be showing a Chromium rich notification, unless freedesktop notifications get rendered the same way on your system.

Maybe it fallbacks to rich notification somehow. Anyway I'll disable the code you referred to.

This is fixed in git and will be available in the next nightly build.

@rogerwang
Sorry to bring this up and make the issues across but may i have a little attention and can you please also take a look on #6020 if possible ?
As I am facing that issue which also related to the notification...

Many thanks for the great work.

Was this page helpful?
0 / 5 - 0 ratings