Skip to content

Commit 949372d

Browse files
committed
Make notifications applet multi instance
1 parent a878e1a commit 949372d

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

files/usr/share/cinnamon/applets/[email protected]/applet.js

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

6060
_openMenu() {
6161
this._update_timestamp();
62+
63+
this._notificationbin.remove_all_children();
64+
this.notifications.forEach(notification => {
65+
global.reparentActor(notification.actor, this._notificationbin);
66+
});
67+
6268
this.menu.toggle();
6369
}
6470

@@ -132,8 +138,6 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
132138
if (notification._destroyed) {
133139
this.notifications.splice(existing_index, 1);
134140
} else {
135-
notification._inNotificationBin = true;
136-
global.reparentActor(notification.actor, this._notificationbin);
137141
notification._timeLabel.show();
138142
}
139143
this.update_list();
@@ -142,11 +146,8 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
142146
return;
143147
}
144148
// Add notification to list.
145-
notification._inNotificationBin = true;
146149
this.notifications.push(notification);
147-
// Steal the notification panel.
148-
this._notificationbin.add(notification.actor);
149-
notification.actor._parent_container = this._notificationbin;
150+
150151
notification.actor.add_style_class_name('notification-applet-padding');
151152
// Register for destruction.
152153
notification.connect('scrolling-changed', (notif, scrolling) => { this.menu.passEvents = scrolling });

files/usr/share/cinnamon/applets/[email protected]/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"name": "Notifications",
44
"description": "Click to display and manage system notifications",
55
"role": "notifications",
6-
"icon": "cs-notifications"
6+
"icon": "cs-notifications",
7+
"max-instances": -1
78
}

js/ui/messageTray.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,10 @@ var Notification = class Notification {
257257
this._actionArea = null;
258258
this._imageBin = null;
259259
this._timestamp = new Date();
260-
this._inNotificationBin = false;
261260

262261
source.connect('destroy', (source, reason) => { this.destroy(reason) });
263262

264263
this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
265-
this.actor._parent_container = null;
266264
this.actor.connect('clicked', () => this._onClicked());
267265
this.actor.connect('destroy', () => this._onDestroy());
268266

@@ -343,7 +341,6 @@ var Notification = class Notification {
343341
*/
344342
update(title, body, params) {
345343
this._timestamp = new Date();
346-
this._inNotificationBin = false;
347344
params = Params.parse(params, {
348345
icon: null,
349346
titleMarkup: false,
@@ -924,8 +921,8 @@ MessageTray.prototype = {
924921

925922
_showNotification: function () {
926923
this._notification = this._notificationQueue.shift();
927-
if (this._notification.actor._parent_container) {
928-
this._notification.actor._parent_container.remove_actor(this._notification.actor);
924+
if (this._notification.actor.get_parent()) {
925+
this._notification.actor.get_parent().remove_actor(this._notification.actor);
929926
}
930927

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

0 commit comments

Comments
 (0)