From 03ff5aa3c69d17f2b83d2eab9d4e94b217486c27 Mon Sep 17 00:00:00 2001 From: Damocles Date: Thu, 16 Apr 2026 20:51:45 +0200 Subject: [PATCH] notifcenter: show urgent (critical) notifications at the top --- modules/NotifService.qml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/NotifService.qml b/modules/NotifService.qml index 0591eae..77b829e 100644 --- a/modules/NotifService.qml +++ b/modules/NotifService.qml @@ -90,7 +90,13 @@ QtObject { }); 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 const max = M.Modules.notifications.maxPopups || 4; @@ -174,6 +180,13 @@ QtObject { root._byId[item.id] = 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(); } catch (e) {} }