-
Notifications
You must be signed in to change notification settings - Fork 15k
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
Notifications: how to disable native and use "chrome"-style instead? #5299
Comments
This doesn't make much sense to me, can you rephrase? This might be relevant https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclick
Silent Notification --> https://developer.mozilla.org/en-US/docs/Web/API/Notification/silent |
As for the first question, I've already managed to handle onclick event through IPC messages. I needed to call show() event on browser window if it's minimized, by clicking on a notification (the code from renderer can't call the code from main so...). Didn't find a better solution. As for sounds, great! I'll test it out. |
IPC messages would probably be the best way to go. There are however methods such as require('remote').getCurrentWindow().show(); Which will work if the window you want to show is the window that launched the notification. Or if the window you want to show is stored as a global variable in the main process you can call require('remote').getGlobal('variableName').show(); |
Thanks. Seems like custom sounds aren't supported yet in Windows? Cause again it's an HTML5 API that's noted in docs only is supported from renderer. I tried declaring the sound path in different ways, didn't work. |
Check if it is supported in the latest Chrome |
Ok I'm blind, "sound" property doesn't work in Chrome as stated on that page, but silent - works. So I've disabled the system's notification sound and just went with audio.play(). Flawless! |
On the original question, we only implemented native notifications, and we don't have plan to port the chrome-style one. |
So that's pretty much the whole question in topic.
Currently I got the notification system built in my app that's being opened as an external URL, but this way I don't know how to handle on click events (so when the window is hidden it's shown up when clicked on) - since the code is in the app, not main.js.
Also, is it possible to disable sounds for native notifications and use HTML5 audio api instead, custom sounds?
Sorry, I'm new to Electron.
The text was updated successfully, but these errors were encountered: