From 34606c0a8ca5d8fc0344ef65f7924362111aabc9 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Tue, 21 Oct 2014 17:15:31 +0530 Subject: [PATCH] messageTray: Summarize notifications when messages queue up It is really annoying for the user to acknowledge multiple notifications when they queue up. So, to prevent a notification flood that has to be handled by the user one-by-one, a summarized-notification feature is added which leaves a single summarized-notification for the user, replacing multiple notifications if the number exceeds 1, which they may or may not acknowledge. When this summarized-notification is acknowledged, the message-tray is opened where they can view the notifications that were summarized. This helps the user concentrate on his primary task simultaneously informing them about the new notifications. https://bugzilla.gnome.org/show_bug.cgi?id=702460 --- js/ui/messageTray.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index cedb410ed..ad7c5c886 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -2432,8 +2432,22 @@ const MessageTray = new Lang.Class({ if (shouldShowNotification && nextNotification) { let limited = this._busy || Main.layoutManager.bottomMonitor.inFullscreen; let showNextNotification = (!limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL); - if (showNextNotification) - this._showNotification(); + if (showNextNotification) { + let len = this._notificationQueue.length; + if (len > 1) { + this._notificationQueue.length = 0; + let source = new SystemNotificationSource(); + this.add(source); + let notification = new Notification(source, ngettext("%d new message", "%d new messages", len).format(len)); + notification.setTransient(true); + notification.connect('clicked', Lang.bind(this, function() { + this.openTray(); + })); + source.notify(notification); + } else { + this._showNotification(); + } + } } } else if (this._notificationState == State.SHOWN) { let expired = (this._userActiveWhileNotificationShown &&