Bug 457949 - Setting "Do not disturb" in KDE notification settings should also prevent notifications from the browser
Summary: Setting "Do not disturb" in KDE notification settings should also prevent not...
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 5.18.8
Platform: Debian stable Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL: https://bugzilla.mozilla.org/show_bug...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-16 10:09 UTC by myndstream
Modified: 2023-05-14 17:36 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description myndstream 2022-08-16 10:09:13 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
When one configures "Do not disturb" in the notification settings in the plasma panel, notifications from the browser can still pop up on the screen, including on the desktop. If this hasn't yet been implemented, please also inhibit any popups from the browser too when this option is set.

I think this would most likely be implemented with or using plasma-browser-integration...but if not please move this issue to plasma or another package.
This would also be useful for tools that set "Gaming mode", because they could prevent all popups via a KDE API that allows setting "Do not disturb" for example.

Firefox notifications can be stopped in about:preferences.

STEPS TO REPRODUCE
1. Set do not disturb in Notifications
2. Get an email for a site where you allowed notifications in the browser or anything else that causes a notification popup

OBSERVED RESULT
The notification shows on the screen.

EXPECTED RESULT
The notification should not show on the screen and get displayed either never or when "Do not disturb" is unset.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian 11
KDE Plasma Version:  5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Kai Uwe Broulik 2022-08-16 17:43:50 UTC
plasma-browser-integration does not affect browser notifications. It's strange that the browser could bypass do not disturb mode, that's a bug in notifications then.
Comment 2 Kai Uwe Broulik 2022-08-16 18:58:30 UTC
What browser is this? Firefox?
Comment 3 myndstream 2022-08-16 20:49:41 UTC
Thanks for moving the issue. Yes, it's the Firefox in Debian11 stable.
Currently I don't have plasma-browser-integration installed. Note the relatively old version in Debian. I think this problem occurred either always or most of the time. I expected browser notifications to get suppressed in this mode but then I thought it was browser-specific and has to be configured in the Firefox preferences.
Comment 4 myndstream 2022-08-16 20:59:19 UTC
These notifications display in the top right, not the bottom right.
Comment 5 Nate Graham 2022-08-17 19:53:53 UTC
That means that the browser is bypassing the system notification server entirely and drawing them itself. This is a bug in the browser, and not anything we can fix in KDE.
Comment 6 myndstream 2022-08-18 10:56:34 UTC
Is this a known issue with Firefox then (all versions of it)? It can be fixed by KDE if one waits with the closure of the issue until an issue is created at the Firefox repo.
Comment 7 Nate Graham 2022-08-18 13:46:57 UTC
It's up to you to do that. :)

See https://community.kde.org/Get_Involved/Issue_Reporting#Understand_what_the_resolution_statuses_mean
Comment 8 myndstream 2022-08-18 14:14:51 UTC
Done: https://bugzilla.mozilla.org/show_bug.cgi?id=1785822

You can get notified about relevant changes there and add any further useful input you may have.

It would be better if it was standard practice to not close bugs before an issue at the dependency has been filed.
Comment 9 myndstream 2022-10-07 10:54:55 UTC
Is this really a bug with Firefox?? From this question it seems like it should work with KDE, please check.

https://unix.stackexchange.com/questions/577244/firefox-notification-popup-timeout

Firefox is v 102.3 and KDE Plasma is v 5.20.5
Comment 10 Nate Graham 2022-10-09 18:53:41 UTC
If the notification looks like any other system notification from any other app, Plasma is in charge of it, and it's a Plasma bug.

If the notification has any other appearance, the app is sending it directly, and then the app is in charge of it and it's an app bug.
Comment 11 myndstream 2022-10-09 19:33:31 UTC
It looks similar to system notifications but these are a bit larger and display in the top right instead of the bottom right. Hopefully, it's not caused by running firefox in firejail (sandboxing). I'll test it again in Debian 12.
Comment 12 myndstream 2023-05-12 15:41:02 UTC
After some testing with https://cleverpush.com/en/test-notifications/ and without firejail sandboxing the problem has been identified:

The firejail profile for firefox (~/.config/firejail/firefox.local) needs to contain this line to have the notifications use KDE notifications and thereby get hidden when "Do not disturb" is enabled (this is a security and privacy issue!):
>dbus-user.talk org.freedesktop.Notifications

However, assuming that the user somehow learns about this (which is unrealistic), it presents a substantial security vulnerability.

Do you know what could be done to make the sandboxed firefox notifications use the system notifications without granting these dbus notifications permissions? For example a specific change at DBUS, a link to an open issue at DBUS about this problem, using another system notifications service, using other notifications if the dbus ones don't work, or something else?
Comment 13 Nate Graham 2023-05-14 17:36:59 UTC
I don't, sorry. But how is making a dbus connection a security issue? Tons of things will break without that. Blocking this is just asking for pain.

Regardless, this isn't a Plasma issue; we can only manipulate notifications that use the standard freedesktop-spec-adhering notification system. We can't do anything with notifications shown directly by the app in the form of custom popup windows because the app can't access the dbus session bus because it's been sandboxed and this was deliberately disabled.