repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

notifications: live content overlay completes replace-by-id

05a865d909ab47737a32913ad5ebeda7ffa9dd80

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Task 1 deduped by id but the renderer still showed stale text on
replace: Quickshell mutates the native Notification object in place and
does NOT re-fire onNotification, so our snapshot froze the original
summary/body. groups() now overlays current native fields via liveRow()
at serialization time (snapshot owns interaction state read/closed/time;
native owns content). Verified: notify-send -r updates the card text.
Adds a selfTest case pinning read-flag preservation across replace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Changed files (1)

quickshell/nuguland/Notifications.qml

Modified
157 157 // distinct ids stay separate
158 158 list = mergeRow(list, {"id": "8", "summary": "other", "closed": false, "read": false});
159 159 expect(list.length === 2, "distinct ids should be separate rows");
160 + // read flag preserved on replace
161 + let rlist = [];
162 + rlist = mergeRow(rlist, {"id": "9", "summary": "x", "closed": false, "read": true});
163 + rlist = mergeRow(rlist, {"id": "9", "summary": "y", "closed": false, "read": false});
164 + expect(rlist[0].read === true, "replace-by-id should preserve original read flag");
160 165 return {
161 166 "pass": failures.length === 0,
162 167 "failures": failures
228 233 return "low";
236 + function liveRow(row) {
237 + const n = nativeNotifications[String(row.nativeId || row.id)];
238 + if (!n)
239 + return row;
240 + return Object.assign({}, row, {
241 + "summary": n.summary !== undefined ? String(n.summary) : row.summary,
242 + "body": n.body !== undefined ? String(n.body) : row.body,
243 + "appName": n.appName || row.appName,
244 + "appIcon": n.appIcon || row.appIcon,
245 + "image": n.image || row.image,
246 + "urgency": urgencyName(n.urgency)
247 + });
231 250 function groups() {
232 251 const byApp = ({
234 - for (let i = 0; i < notifications.length; i++) {
235 - const n = notifications[i];
253 + for (let raw = 0; raw < notifications.length; raw++) {
254 + const n = liveRow(notifications[raw]);
236 255 if (n.closed)
237 256 continue;