From 0a59c4dcd6b9b567672727d76d43c5334d42c66b Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 11 Sep 2024 00:17:35 -0400 Subject: [PATCH] Don't re-show repeated notifications 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 --- src/shell/notification.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/shell/notification.js b/src/shell/notification.js index 78b7f54bc..a6940d2e3 100644 --- a/src/shell/notification.js +++ b/src/shell/notification.js @@ -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; } @@ -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;