Skip to content

Commit 6f1b82d

Browse files
committed
Make notifications applet multi-instance
1 parent 501a250 commit 6f1b82d

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
6565

6666
_openMenu() {
6767
this._update_timestamp();
68+
69+
this.notifications.forEach(notification => {
70+
if (notification.actor.get_parent() !== this._notificationbin)
71+
global.reparentActor(notification.actor, this._notificationbin);
72+
});
73+
6874
this.menu.toggle();
6975
}
7076

@@ -138,8 +144,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
138144
if (notification._destroyed) {
139145
this.notifications.splice(existing_index, 1);
140146
} else {
141-
notification._inNotificationBin = true;
142-
global.reparentActor(notification.actor, this._notificationbin);
143147
notification._timeLabel.show();
144148
}
145149
this.update_list();
@@ -148,11 +152,8 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
148152
return;
149153
}
150154
// Add notification to list.
151-
notification._inNotificationBin = true;
152155
this.notifications.push(notification);
153-
// Steal the notification panel.
154-
this._notificationbin.add(notification.actor);
155-
notification.actor._parent_container = this._notificationbin;
156+
156157
notification.actor.add_style_class_name('notification-applet-padding');
157158
// Register for destruction.
158159
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)