Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
this.settings.bind("keyOpen", "keyOpen", this._setKeybinding);
this.settings.bind("keyClear", "keyClear", this._setKeybinding);
this.settings.bind("showNotificationCount", "showNotificationCount", this.update_list);
this.settings.bind("showNewestFirst", "showNewestFirst", this.update_list);
this._setKeybinding();

// Layout
Expand Down Expand Up @@ -166,6 +167,7 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
this.actor.show();
this.clear_action.actor.show();
this.set_applet_label(count.toString());
this._reorderNotifications();
// Find max urgency and derive list icon.
let max_urgency = -1;
for (let i = 0; i < count; i++) {
Expand Down Expand Up @@ -224,6 +226,25 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
this.update_list();
}

_reorderNotifications() {
let orderedNotifications = this.notifications.slice();

if (this.showNewestFirst) {
orderedNotifications.reverse();
}

// Remove all children without destroying them.
let children = this._notificationbin.get_children();
for (let i = 0; i < children.length; i++) {
this._notificationbin.remove_child(children[i]);
}

// Add them back in desired order.
for (let i = 0; i < orderedNotifications.length; i++) {
this._notificationbin.add_child(orderedNotifications[i].actor);
}
}

_show_hide_tray() { // Show or hide the notification tray.
if(!global.settings.get_boolean(PANEL_EDIT_MODE_KEY)) {
if (this.notifications.length || this.showEmptyTray) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"default": true,
"description": "Show the number of notifications"
},
"showNewestFirst": {
"type": "switch",
"default": false,
"description": "Show newest notifications first"
},
"section3": {
"type": "section",
"description": "Keyboard shortcuts"
Expand Down