Skip to content

Commit

Permalink
Don't re-show repeated notifications
Browse files Browse the repository at this point in the history
GSConnect receives a lot of duplicate notifications, whether due to
reconnects, proactively requesting updates, etc.

Since GNOME 46, each of those repeats has been popped up as a new
banner notification every time it's received, even if nothing has
changed in the notification content. This is extremely disruptive.

To avoid that, don't blindly flag all repeated notifications as
"unacknowledged", which will cause them to be popped up again.
Only do so if the content has changed. (This covers re-displaying
banners for SMS conversations that receive an additional message,
since those are sent as updates to the existing notification.)

Fixes #1855
  • Loading branch information
ferdnyc committed Sep 11, 2024
1 parent ab988fa commit 09892b9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/shell/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,20 @@ const Source = GObject.registerClass({
if (cachedNotification) {
cachedNotification.requestReplyId = requestReplyId;

// Bail early If @notificationParams represents an exact repeat
const title = notification.title;
const body = notification.body
? notification.body
: null;

// Bail early If @notification represents an exact repeat
if (cachedNotification.title === title &&
cachedNotification.body === body)
return cachedNotification;

// If the details have changed, flag as an update
cachedNotification.title = title;
cachedNotification.body = body;

cachedNotification.acknowledged = false;
return cachedNotification;
}

Expand Down Expand Up @@ -304,10 +305,8 @@ const Source = GObject.registerClass({
* notification limit (3)
*/
_addNotificationToMessageTray(notification) {
if (this.notifications.includes(notification)) {
notification.acknowledged = false;
if (this.notifications.includes(notification))
return;
}

while (this.notifications.length >= 10) {
const [oldest] = this.notifications;
Expand Down

0 comments on commit 09892b9

Please sign in to comment.