From 641ccb70724f8967439495e2356b2d7a654053cf Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Sat, 4 Apr 2020 17:37:41 -0700 Subject: [PATCH] Shell Notifications: set a limit of 10 notifications from GSConnect Re-apply the notification limit from GSConnect, set to 10. This should stop notifications from growing indefinitely, with the consequence that the notifications that end up in the message tray is non-deterministic. cc #364 Backported to v33 --- src/shell/notification.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell/notification.js b/src/shell/notification.js index dc93de955..f345cdde9 100644 --- a/src/shell/notification.js +++ b/src/shell/notification.js @@ -246,13 +246,16 @@ } /** - * Override to lift the usual notification limit (3) + * Override to raise the usual notification limit (3) * See: https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/ui/messageTray.js#L773-L786 */ pushNotification(notification) { if (this.notifications.includes(notification)) return; + while (this.notifications.length >= 10) + this.notifications.shift().destroy(MessageTray.NotificationDestroyedReason.EXPIRED); + notification.connect('destroy', this._onNotificationDestroy.bind(this)); notification.connect('acknowledged-changed', this.countUpdated.bind(this)); this.notifications.push(notification);