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

Respect OS Do Not Disturb mode #788

Open
pepyakin opened this issue Nov 28, 2018 · 19 comments
Open

Respect OS Do Not Disturb mode #788

pepyakin opened this issue Nov 28, 2018 · 19 comments

Comments

@pepyakin
Copy link

Description

In macOS there is a special mode called "Do not disturb" (DND). It is designed for cases when you need to focus on something or you just merely need to disable all notifications (imagine being on a talk but still being connected to the internet). If you activate this mode apps become silent, all notifications are not shown, etc.

However, it seems like that the Riot macOS app doesn't respect this setting and still will produce sounds. This is not solvable with individual notification settings (basically there is too many people you actually want to keep notifications while not in DND) and it is awkward to disable all notifications settings because it is too easy to forget to turn them off and turn them off again only for one app.

Version information

MacOS 10.14.1
Version 0.17.6 (0.17.6)

@aaronraimist
Copy link
Contributor

:/ I don't think Electron has a built in way to tell if DND is enabled. Looks like Electron recommends using this library https://github.com/felixrieseberg/electron-notification-state which only has one commit... maybe it's just really stable and good at it's current state?

@lampholder
Copy link
Member

That felixrieseberg library just wraps two other libraries for fetching mac/windows notification states (also written by felixrieseberg, and with 7 and 9 commits respectively). Scanning the code it does look feasible that it might just work?

@yajo
Copy link

yajo commented Jun 6, 2020

As explained in element-hq/element-web#13941, the same happens in linux.

@Half-Shot
Copy link
Member

The Do Not Disturb mode on gnome is the dconf setting /org/gnome/desktop/notifications/show-banners. Element notifs should already be blocked by the setting, but sounds won't be. We will need to find a library that allows us to listen on dbus for when this value is updated.

@Half-Shot
Copy link
Member

Half-Shot commented Aug 10, 2020

#133 should hopefully address folks on GNOME

@otheus
Copy link

otheus commented Nov 10, 2020

Just to be clear, the preferred way on MacOS is to use the notifications API, so that do-not-disturb mode and other OS behavior is consistent.

@t3chguy
Copy link
Member

t3chguy commented Nov 10, 2020

Electron does not support accessing that API seemingly, but closest we can get is to try and read the DND state using https://www.electronjs.org/docs/tutorial/notifications#do-not-disturb--session-state

@pepyakin
Copy link
Author

pepyakin commented Nov 10, 2020

Op here. FWIW, for me this was solved by migrating to the web version, to PWA app within Chrome to be exact.

@tawfiek
Copy link

tawfiek commented Mar 23, 2021

Electron does not support accessing that API seemingly, but closest we can get is to try and read the DND state using https://www.electronjs.org/docs/tutorial/notifications#do-not-disturb--session-state

Electron refers to the same package of felixrieseberg in there official docs, but in the package's GitHub repo I found more than one issue complaint that this package is deprecated for the newer versions of node, I think it's a bad Idea to rely on it in element.
maybe we can fork it update it's dependencies and republish it, then use it into our codebase or ...
"it" refers to the packages that this lib wrap, since it just a warper for : macos-notification-state and windows-notification-state written with the same guy as @lampholder said

@otheus
Copy link

otheus commented Apr 30, 2021

@tawfiek In general, I think this is a good idea. It always seems suspect to me to rely on 3rd party libraries whose code has not been audited and which cannot be absolutely authenticated. AFter all, this is communication software for private data...

@germain-gg
Copy link
Contributor

We have a do not disturb mode in user settings now. We could hook the OS level setting to honour that user preference.

From what I understand we will only be able to do that on the Electron side as the media queries are not exposing any of that

@HarHarLinks
Copy link

We have a do not disturb mode in user settings now.

This was removed from labs in matrix-org/matrix-react-sdk@4d7b7c4 and I miss it dearly.

@pszypowicz
Copy link

pszypowicz commented Jun 18, 2022

There seem to be a user space lib to detect dnd mode on mac: https://github.com/felixrieseberg/macos-notification-state

My workaround is to close element app when I'm expecting to focus on work. Not ideal one may say /sarcasm

@SimonBrandner SimonBrandner changed the title Feature request: Respect OS Do Not Disturb mode Respect OS Do Not Disturb mode Jul 11, 2022
@JMoVS
Copy link

JMoVS commented Nov 1, 2022

surely there is a way 4 years later to use the native notification system and get do not disturb following for free, right? Is this not annoying others?

@HarHarLinks
Copy link

There is some related spec work (currently not progressing):

matrix-org/matrix-spec-proposals#3026
matrix-org/matrix-spec-proposals#3767

@JMoVS
Copy link

JMoVS commented Nov 1, 2022

Hi @HarHarLinks , the mentioned specs are unrelated to this bug. They are a great feature, but the bug here is about being a good platform citizen as a desktop app.

@t3chguy t3chguy transferred this issue from element-hq/element-web Apr 18, 2023
@Conan-Kudo
Copy link

I would really like this feature to be implemented. Element is the only application I run on my desktop (Fedora Linux 38 with KDE Plasma Desktop) that does not respect the system-wide do-not-disturb setting. Even Slack (also an Electron app) respects the setting properly.

@uzantome
Copy link

Here's a PR from Mattermost, another electron-based messenger, implementing this:

mattermost/desktop#1629

@t3chguy
Copy link
Member

t3chguy commented Mar 11, 2024

@uzantome looks like it only supports Linux & Windows, and would create extra cost on the latter as it'd require signing extra binaries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests