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

Remove settings button from native notifications on Linux #6194

Closed
bastimeyer opened this issue Oct 7, 2017 · 9 comments
Closed

Remove settings button from native notifications on Linux #6194

bastimeyer opened this issue Oct 7, 2017 · 9 comments
Assignees
Labels

Comments

@bastimeyer
Copy link

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:

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!

@rogerwang
Copy link
Member

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

@bastimeyer
Copy link
Author

bastimeyer commented Oct 24, 2017

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)

@rogerwang
Copy link
Member

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

@rogerwang
Copy link
Member

CC @Christywl can you verify?

@bastimeyer
Copy link
Author

bastimeyer commented Oct 24, 2017

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: [] } );

@bastimeyer
Copy link
Author

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

@rogerwang
Copy link
Member

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

@rogerwang
Copy link
Member

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

@deltapath-eric
Copy link

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

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

3 participants