Skip to content

Commit 29e48b5

Browse files
committed
Make notifications applet multi instance
1 parent 501a250 commit 29e48b5

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,18 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
6161
if (MessageTray.extensionsHandlingNotifications === 0) {
6262
this._clear_all();
6363
}
64+
65+
this.destroy();
6466
}
6567

6668
_openMenu() {
6769
this._update_timestamp();
70+
71+
this._notificationbin.remove_all_children();
72+
this.notifications.forEach(notification => {
73+
global.reparentActor(notification.actor, this._notificationbin);
74+
});
75+
6876
this.menu.toggle();
6977
}
7078

@@ -138,8 +146,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
138146
if (notification._destroyed) {
139147
this.notifications.splice(existing_index, 1);
140148
} else {
141-
notification._inNotificationBin = true;
142-
global.reparentActor(notification.actor, this._notificationbin);
143149
notification._timeLabel.show();
144150
}
145151
this.update_list();
@@ -148,11 +154,8 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
148154
return;
149155
}
150156
// Add notification to list.
151-
notification._inNotificationBin = true;
152157
this.notifications.push(notification);
153-
// Steal the notification panel.
154-
this._notificationbin.add(notification.actor);
155-
notification.actor._parent_container = this._notificationbin;
158+
156159
notification.actor.add_style_class_name('notification-applet-padding');
157160
// Register for destruction.
158161
notification.connect('scrolling-changed', (notif, scrolling) => { this.menu.passEvents = scrolling });

files/usr/share/cinnamon/applets/notifications@cinnamon.org/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"uuid": "notifications@cinnamon.org",
33
"name": "Notifications",
44
"description": "Click to display and manage system notifications",
5-
"icon": "cs-notifications"
5+
"icon": "cs-notifications",
6+
"max-instances": -1
67
}

js/ui/messageTray.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,10 @@ var Notification = class Notification {
262262
this._actionArea = null;
263263
this._imageBin = null;
264264
this._timestamp = new Date();
265-
this._inNotificationBin = false;
266265

267266
source.connect('destroy', (source, reason) => { this.destroy(reason) });
268267

269268
this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
270-
this.actor._parent_container = null;
271269
this.actor.connect('clicked', () => this._onClicked());
272270
this.actor.connect('destroy', () => this._onDestroy());
273271

@@ -348,7 +346,6 @@ var Notification = class Notification {
348346
*/
349347
update(title, body, params) {
350348
this._timestamp = new Date();
351-
this._inNotificationBin = false;
352349
params = Params.parse(params, {
353350
icon: null,
354351
titleMarkup: false,
@@ -929,8 +926,8 @@ MessageTray.prototype = {
929926

930927
_showNotification: function () {
931928
this._notification = this._notificationQueue.shift();
932-
if (this._notification.actor._parent_container) {
933-
this._notification.actor._parent_container.remove_actor(this._notification.actor);
929+
if (this._notification.actor.get_parent()) {
930+
this._notification.actor.get_parent().remove_actor(this._notification.actor);
934931
}
935932

936933
this._notificationBin.child = this._notification.actor;

0 commit comments

Comments
 (0)