summaryrefslogtreecommitdiff
blob: 8c2846c5ecbdf78db3b2c475d8cd396878eb2537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 641ccb70724f8967439495e2356b2d7a654053cf Mon Sep 17 00:00:00 2001
From: Andy Holmes <andrew.g.r.holmes@gmail.com>
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 <pacho@gentoo.org>
---
 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);