notifcenter: show urgent (critical) notifications at the top

This commit is contained in:
Damocles 2026-04-16 20:51:45 +02:00
parent f174d35383
commit 03ff5aa3c6

View file

@ -90,7 +90,13 @@ QtObject {
}); });
root._byId[item.id] = item; root._byId[item.id] = item;
root.list = [item, ...root.list]; root.list = [item, ...root.list].sort((a, b) => {
const aU = a.urgency === NotificationUrgency.Critical ? 1 : 0;
const bU = b.urgency === NotificationUrgency.Critical ? 1 : 0;
if (aU !== bU)
return bU - aU;
return b.time - a.time;
});
// Trim excess popups // Trim excess popups
const max = M.Modules.notifications.maxPopups || 4; const max = M.Modules.notifications.maxPopups || 4;
@ -174,6 +180,13 @@ QtObject {
root._byId[item.id] = item; root._byId[item.id] = item;
root.list.push(item); root.list.push(item);
} }
root.list.sort((a, b) => {
const aU = a.urgency === NotificationUrgency.Critical ? 1 : 0;
const bU = b.urgency === NotificationUrgency.Critical ? 1 : 0;
if (aU !== bU)
return bU - aU;
return b.time - a.time;
});
root._changed(); root._changed();
} catch (e) {} } catch (e) {}
} }