fix: batch clear all notifs to prevent blocking

This commit is contained in:
2 * r + 2 * t 2026-04-03 20:47:13 +11:00
parent b83ac6e50a
commit 5b153fde8f

View file

@ -149,14 +149,24 @@ Item {
id: clearTimer
repeat: true
triggeredOnStart: true
interval: Math.max(15, Math.min(80, 69.8 - 12.3 * Math.log(Notifs.notClosed.length)))
onTriggered: {
const first = Notifs.notClosed[0];
if (first) {
for (const n of Notifs.notClosed.filter(n => n.appName === first.appName))
n.close();
} else {
if (!first) {
stop();
return;
}
const appName = first.appName;
let cleared = 0;
for (const n of Notifs.notClosed.filter(n => n.appName === appName)) {
n.close();
cleared++;
if (cleared > 30) {
interval = 5;
return;
}
}
}
}