Bug 459774 - Make "resident" notifications the default.
Summary: Make "resident" notifications the default.
Status: ASSIGNED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: master
Platform: unspecified Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
: 460350 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-09-28 13:38 UTC by Naxdy
Modified: 2024-03-05 08:19 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Example of how notifications look with "resident" forced to "true" (159.76 KB, image/png)
2022-09-28 13:38 UTC, Naxdy
Details
Example of how notifications look with "resident" forced to "true" (151.69 KB, image/png)
2022-09-28 13:39 UTC, Naxdy
Details
A Discord notification with the "resident = true" hack applied (151.00 KB, image/png)
2022-09-28 18:15 UTC, Naxdy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Naxdy 2022-09-28 13:38:34 UTC
Created attachment 152491 [details]
Example of how notifications look with "resident" forced to "true"

Currently, a lot of notifications lose some or all of their functionality after moving from the standalone notification popup into the notification applet.

As I understand, the idea is that if notifications contain a "resident" hint, indicating to plasma that this functionality should be preserved.

In my opinion, this should be an opt-out rather than an opt-in (as it currently is).

As it stands, only a very small minority of applications actually opt in to this functionality. Those that do not are clearly missing functionality once their notifications move into the applet. This creates a sort of "race against time", where a user might feel pressured to click on the notification as soon as possible, or drastically increase notification timeout, lest they will be unable to navigate to the notification's origin as easily.

Prime examples here are messaging apps such as Slack or Discord, where the notification is designed to bring you to the relevant chat immediately. Once this functionality is lost, navigating to the relevant channel can become a chore, since you will either have to rely on the application's internal notification system (e.g. Discord's inbox) or even navigate completely manually.

What adds additional frustration is that Plasma seems to be one of the only shells that exhibit this behavior. The GNOME shell, as well as the Windows desktop both preserve full notification functionality even once the initial popup has been dismissed (be it manually or automatically). This makes Plasma a clear outlier in this situation.

For experimental purposes, I have compiled my local `plasma-workspace` to ignore the "resident" hint, and always display the additional functionality. Without any further modifications, this results in the aforementioned functionality being restored in form of a button. The label of said button appears to be different for each application. Discord & Slack use "View", whereas Thunderbird uses "Activate".

Furthermore, for some applications, the button loses functionality after the first press, whereas for others, it continues to work indefinitely. As such, if we decide to enable the "resident" behavior for every app, it would be appropriate to dismiss the notification automatically once this button has been pressed, as this behavior would be intuitive anyway.

I've attached some screenshots of my local notification applet with the "resident" hint forced to "true" for every app. Even in its current state, it has already improved usability of the notification applet tremendously for me, and I no longer feel pressured to click on every notification as soon as possible.

Alternatively, if we do not want to force this behavior for every app, I suggest making it a user-configurable option either in the applet or system settings. This way, users can keep the current behavior if they so choose.
Comment 1 Naxdy 2022-09-28 13:39:04 UTC
Created attachment 152492 [details]
Example of how notifications look with "resident" forced to "true"
Comment 2 Nate Graham 2022-09-28 17:19:51 UTC
I agree 100%. See also Bug 407667.
Comment 3 Nate Graham 2022-09-28 17:20:13 UTC
Wanna submit a merge request to do this?
Comment 4 David Edmundson 2022-09-28 17:49:17 UTC
There's a massive difference between what your saying happens and the spec.

" When set the server will not automatically remove the notification when an action has been invoked. The notification will remain resident in the server until it is explicitly removed by the user or by the sender. This hint is likely only useful when the server has the "persistence" capability. "

I don't see how that corresponds to the previous concerns especially about "race against time" to click things or how anything looks. The spec implies it shouldn't change the time at all.

We might be doing something inappropriate with the hint that needs identifying and fixing, but blinding changing does not seem the way to go.
Comment 5 Nicolas Fella 2022-09-28 18:09:12 UTC
I don't think this is something we can do. Apps expect a specific behavior depending on whether resident is set or not, we can't just change that without potentially breaking apps
Comment 6 Nicolas Fella 2022-09-28 18:13:23 UTC
To give one example: KNotifications deletes the client-side KNotification object when the notification is closed (unless the notification is marked as resident). If the server would start to treat it as resident and don't close it then the object would never be deleted, leaking memory
Comment 7 Naxdy 2022-09-28 18:15:41 UTC
Created attachment 152494 [details]
A Discord notification with the "resident = true" hack applied
Comment 8 Naxdy 2022-09-28 18:16:04 UTC
(In reply to David Edmundson from comment #4)
> There's a massive difference between what your saying happens and the spec.
> 
> " When set the server will not automatically remove the notification when an
> action has been invoked. The notification will remain resident in the server
> until it is explicitly removed by the user or by the sender. This hint is
> likely only useful when the server has the "persistence" capability. "
> 
> I don't see how that corresponds to the previous concerns especially about
> "race against time" to click things or how anything looks. The spec implies
> it shouldn't change the time at all.
> 
> We might be doing something inappropriate with the hint that needs
> identifying and fixing, but blinding changing does not seem the way to go.

I will use Discord as an example of what happens. When you get a Discord message, be it a tag, direct message, or otherwise, you will get a notification on your desktop. When this notification appears as a popup on Plasma, you are able to click this notification, upon which the Discord client will be focused, and it then navigates you to the part in the application where that message was received (either a channel on a server you're a member of, or a DM conversation).

Currently however, clicking the notification while it is in its popup state is the only way to evoke this functionality. Once the notification expires and sits in the notification applet, it is no longer clickable, and it does not present any buttons to interact with either. Its functionality is therefore lost.

The hack I did on my system, is to edit `libnotificationmanager/notification.cpp` and change the line that reads `resident = hints.value(QStringLiteral("resident")).toBool();` to simply `resident = true;` - just to see what happens.

Upon performing this hack, the Discord notification within the notification applet now has a little button added to it (see screenshot). Upon clicking this button, I am brought to the place within Discord where the message in question originated. In other words, the functionality which was previously lost upon expiry of the notification popup is now restored.

In the case of Discord however, clicking the "View" button only works once. Any subsequent clicks have no effect. Some other applications are similar in this behavior, some are not. In other DEs (using GNOME & Windows as reference), it is common practice to remove the notification from the history once it has been interacted with, perhaps we could do something similar here.

If the "resident" property is not the right point to edit here, then let it be something else. The point of this issue isn't to change how "resident" functions necessarily, it is simply to retain the functionality of the vast majority of notifications once their initial popup has expired.
Comment 9 Nate Graham 2022-09-28 18:20:31 UTC
It sounds like you're using this hack as a workaround for the lack of Bug 407667? Can we fix that without doing this?
Comment 10 Nicolas Fella 2022-09-28 18:22:20 UTC
Using the resident hint is the correct fix for https://bugs.kde.org/show_bug.cgi?id=459774, but it's something that applications need to support, not something we can hack into Plasma
Comment 11 Nicolas Fella 2022-09-28 18:23:37 UTC
*for https://bugs.kde.org/show_bug.cgi?id=407667
Comment 12 Naxdy 2022-09-28 18:24:15 UTC
(In reply to Nate Graham from comment #9)
> It sounds like you're using this hack as a workaround for the lack of Bug
> 407667? Can we fix that without doing this?

I'm using it as a workaround for https://bugs.kde.org/show_bug.cgi?id=407361 actually. 407667 only suggests to focus the app, this hack provides full functionality of the initial popup.
Comment 13 Nate Graham 2022-09-28 18:24:28 UTC
Why can't we just make expired non-resident notifications clickable in the history view, such that clicking on them launches or activates the app that sent the notification? It won't be perfect since it couldn't take you to exactly the page or view that's relevant to the notification, but it would be better than nothing.
Comment 14 Naxdy 2022-09-28 18:26:37 UTC
(In reply to Nate Graham from comment #13)
> Why can't we just make expired non-resident notifications clickable in the
> history view, such that clicking on them launches or activates the app that
> sent the notification? It won't be perfect since it couldn't take you to
> exactly the page or view that's relevant to the notification, but it would
> be better than nothing.

I think this would lead to confusion more than anything. Users wondering why when "sometimes" they click the notification they get to the proper part in the app, and "sometimes" they don't. Many likely won't make the connection that notifications in the applet vs. popup behave differently, leading to a frustrating experience.
Comment 15 Naxdy 2022-09-28 23:07:04 UTC
I've submitted a much-less-hacky implementation here: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2178

This does not touch resident functionality at all and should therefore mitigate any potential issues as mentioned by Nicolas.
Comment 16 Nicolas Fella 2022-10-13 12:20:08 UTC
*** Bug 460350 has been marked as a duplicate of this bug. ***
Comment 17 Carlos Solís 2022-10-16 19:49:49 UTC
Regarding the implementation, I was under the impression that the hints boolean values, which include the "resident" and "transient" values, worked like this:

- Resident: the notification is not dismissed until the user manually closes it. Similar to permanent notifications on Android.
- Transient: the notification is automatically dismissed and furthermore, is not stored in the tray when it times out.

Our issue currently comes with the behavior for the default case (no resident hint, no transient hint either), which seems to be left up to each implementation as per the specs. (See https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html#hints ). They explicitly state that "Neither clients nor notification servers are required to support any hints". However, besides of these boolean values there's also the urgency level, which does include a recommended implementation cue - regarding critical urgency notifications, "They should only be closed when the user dismisses them, for example, by clicking on the notification."
Comment 18 Naxdy 2022-10-16 21:47:15 UTC
(In reply to Carlos Solís from comment #17)
> Regarding the implementation, I was under the impression that the hints
> boolean values, which include the "resident" and "transient" values, worked
> like this:
> 
> - Resident: the notification is not dismissed until the user manually closes
> it. Similar to permanent notifications on Android.
> - Transient: the notification is automatically dismissed and furthermore, is
> not stored in the tray when it times out.
> 
> Our issue currently comes with the behavior for the default case (no
> resident hint, no transient hint either), which seems to be left up to each
> implementation as per the specs. (See
> https://specifications.freedesktop.org/notification-spec/notification-spec-
> latest.html#hints ). They explicitly state that "Neither clients nor
> notification servers are required to support any hints". However, besides of
> these boolean values there's also the urgency level, which does include a
> recommended implementation cue - regarding critical urgency notifications,
> "They should only be closed when the user dismisses them, for example, by
> clicking on the notification."

That's correct. I do apologize for the confusion, because the problem I've outlined isn't actually that notifications aren't "resident" by default (although this would solve the problem at the cost of producing others), but simply that they lose their interactive functionalities once the popup disappears and they are stored in history only.

Resident notifications aren't expired the same way "normal" notifications are, which is why they keep their interactive features - therefore I initially thought making all notifications resident should be the default behavior.

The implementation I've submitted seeks to establish a middle-ground of sorts, by initially treating "resident" notifications and those with interactive features the same way: To not formally "expire" them when the popup is gone, but rather mark them expired, so the popup disappears, but the notification is technically kept open.

The treatment of notifications then differs: Resident notifications are kept open no matter how many times a user interacts with them (as was the case before), but regular notifications are then properly expired (because most seem to lose their functionality after one interaction anyway). This then also causes any interactive buttons in the history to disappear (since they would lose functionality anyway most of the time).

There is currently one situation in which this would produce an unexpected result however: If the application that fired an interactive notification (e.g. Discord) is closed before the notification has been interacted with, the interaction would of course not produce any results, since there is no client to handle the event.