nylas / nylas-mail

:love_letter: An extensible desktop mail app built on the modern web. Forks welcome!
https://nylas.com/nylas-mail/
MIT License
24.8k stars 1.38k forks source link

Please respect OS's Dot Not Disturb setting #715

Open jacobbubu opened 8 years ago

jacobbubu commented 8 years ago

N1 keeps playing sound and hoping up the notification when the new mail arriving even I turned on the Dot Not Disturb on MacOS.

mbilker commented 8 years ago

I thought DND only applied to notifications through the Notification Center, which N1 uses for notifications under OS X.

jacobbubu commented 8 years ago

I've tested again. The sound played by N1 no matter how does DND set.

mbilker commented 8 years ago

Hmm. If DND is set, does Chrome play sounds from a website using HTML5 Audio (e.g. YouTube with HTML5 player)?

mbilker commented 8 years ago

@jacobbubu The offending line is part of sound-registry.coffee.

It utilizes the HTML5 Audio element to play audio. Normally this is fine since you are using the webpage that is playing audio and you can close the webpage when you don't want it to.

This is why N1 plays audio when DND is set. It seems DND is hard to detect from inside OS X applications and, from the part of Electron's documentation I read, Electron doesn't offer a way to detect DND on OS X.

jacobbubu commented 8 years ago

Playing sounds in video that is initiated by myself and I'm expecting to hear that. When I turn the DND on that means I'm not expecting any interruption happens during that time, so playing sound for incoming mail becomes a disturbance (I can not control when the mail comes in).

mbilker commented 8 years ago

Wow. We commented at the same time.

jacobbubu commented 8 years ago

Thank you for the explanation. Looks like that we need a native module to do that. Anyway that is a nice-to-fix bug.

mbilker commented 8 years ago

Yeah. I could look to see if someone made a native module compatible with Electron.

mbilker commented 8 years ago

And.. unfortunately nobody has created a Do Not Disturb module. I am not familiar with Mac OS X's DND setting and from a quick Stack Overflow search many developers don't encounter this type of issue.

bengotow commented 8 years ago

It looks like it's possible to ask the operating system whether "Do not Disturb" is active, but it's not pleasant at all (http://apple.stackexchange.com/questions/59572/get-os-x-notification-center-state-from-the-command-line/69760#69760). We'll look to implement this in a native node module in the future, but we may table it for now. Pull requests welcome of course if anyone wants to give it a go before our team does!

joshuat commented 7 years ago

It's really annoying to have to manually quit N1 prior to giving any presentation. Has any progress been made on this?