From d28100016bccfffb7be90018b611b22db005fde5 Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 16:00:08 +0200 Subject: [PATCH 1/2] fix persisted notification dismiss: unique IDs to avoid D-Bus collision --- modules/NotifService.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/NotifService.qml b/modules/NotifService.qml index 62f197c..99c9b07 100644 --- a/modules/NotifService.qml +++ b/modules/NotifService.qml @@ -142,7 +142,10 @@ QtObject { onLoaded: { try { const data = JSON.parse(text()); - for (const n of data) { + for (let i = 0; i < data.length; i++) { + const n = data[i]; + // Prefix persisted IDs to avoid collision with live D-Bus IDs + n.id = "p_" + (n.id ?? i) + "_" + n.time; n.popup = false; n.closed = false; n.notification = null; From 29a24b42057fdf69bb1be3ffb769bf773059b78f Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 16:04:54 +0200 Subject: [PATCH 2/2] fix dismiss: remove from list instead of marking closed --- modules/NotifCenter.qml | 2 +- modules/NotifService.qml | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/modules/NotifCenter.qml b/modules/NotifCenter.qml index d81261f..c96de2d 100644 --- a/modules/NotifCenter.qml +++ b/modules/NotifCenter.qml @@ -133,7 +133,7 @@ M.PopupPanel { // Notification list Repeater { - model: M.NotifService.active.slice(0, 20) + model: M.NotifService.list.slice(0, 20) delegate: Item { id: notifItem diff --git a/modules/NotifService.qml b/modules/NotifService.qml index 99c9b07..38a45d6 100644 --- a/modules/NotifService.qml +++ b/modules/NotifService.qml @@ -12,26 +12,23 @@ QtObject { property var list: [] property bool dnd: false - readonly property var active: list.filter(n => !n.closed) - readonly property var popups: list.filter(n => n.popup && !n.closed) - readonly property int count: active.length + readonly property var popups: list.filter(n => n.popup) + readonly property int count: list.length function dismiss(notifId) { - const n = list.find(n => n.id === notifId); - if (n) { - n.popup = false; - n.closed = true; + const idx = list.findIndex(n => n.id === notifId); + if (idx >= 0) { + const n = list[idx]; n.notification?.dismiss(); + list.splice(idx, 1); _changed(); } } function dismissAll() { - for (const n of list.slice()) { - n.popup = false; - n.closed = true; + for (const n of list.slice()) n.notification?.dismiss(); - } + list = []; _changed(); } @@ -85,7 +82,7 @@ QtObject { // Dismiss excess popups (keep in history, just hide popup) const max = M.Modules.notifications.maxPopups || 4; - const currentPopups = root.list.filter(n => n.popup && !n.closed); + const currentPopups = root.list.filter(n => n.popup); if (currentPopups.length > max) { for (let i = max; i < currentPopups.length; i++) currentPopups[i].popup = false; @@ -123,7 +120,7 @@ QtObject { property Timer _saveTimer: Timer { interval: 1000 onTriggered: { - const data = root.active.map(n => ({ + const data = root.list.map(n => ({ id: n.id, summary: n.summary, body: n.body,