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
Add support for Notification Actions (added in Chrome 48) #4424
Comments
Windows 10: Yes Also, totally into this idea |
I'm also super into this, but I'd say that the implementation on both OS X and Windows is not trivial. For starters, the Windows 10 UWP Notification API is super rich and can do all kinds of fancy things, but it doesn't use callbacks, but instead activation arguments (which is cool, because one can launch other apps via notification, but the model makes it hard to implement in Electron). Good news: Code is available. On OS X, things are a little bit less difficult, but still annoying (the model is super-limiting, as @bengotow already pointed out). However, if we conform to the limits, a callback is fairly simple: We already ask the Basically, if somebody wants to have a coffee/beer session with me (Nylas? Slack? GitHub?), we could probably hack this out in three hours or so. |
Hey! I've started playing with this, and it looks like it may be more of a mess than I imagined. I was able to add a libchromiumcontent patch to remove an assertion which blocked calls to It looks like we may be blocked on the event-handling side, though. Chromium calls Any ideas? I'm just beginning to source-dive Chromium so I may be wrong—I haven't traced far enough back to see where they become separated. Haha @felixrieseberg I think some beers might definitely be in order... One other caveat I discovered: On Mac OS X, notifications with actions are "Alerts", which are sticky. To show "Alert"-style notifications, the app needs to be code-signed and include an item in it's Info.plist. Beyond being a bit of a pain, this means that effectively re-producing native behaviors might require additional APIs for programmatically dismissing notifications, which I don't think exist. |
@bengotow If it helps, this is how I currently display native notifications on OS X (using nodobjc): https://github.com/Aluxian/Whatsie/blob/master/src/scripts/browser/components/native-notifier/impl-darwin.js |
Ah, I'd like this as well! I attempted to get the serviceworker APIs working on electron, but notifications from a service worker do not show up. Alternatively, chrome APP platform implements chrome.notifications.create (which allows actions), and may be worth looking at. Not sure if that is implemented differently from the serviceworker.newNotification. |
"I attempted to get the serviceworker APIs working on electron, but notifications from a service worker do not show up." +1 Even if it could fall-back to the standard Notification system, it would be helpful? |
Closing with merge of @sethlu's above PR. |
It would be really great if Electron supported the "notification actions" feature added in Chrome 48:
https://www.chromestatus.com/features/5906566364528640
https://developers.google.com/web/updates/2016/01/notification-actions?hl=en
Essentially, you say:
To show the notification, and then listen for 'notificationclick' DOM event, which gives you the name of the chosen action.
The text was updated successfully, but these errors were encountered: