IPC: notifications - add removeOldestHistory

This commit is contained in:
Ly-sec
2025-11-29 08:30:12 +01:00
parent ce7a412956
commit 0d6b70a4c1
2 changed files with 17 additions and 0 deletions
+4
View File
@@ -78,6 +78,10 @@ Item {
NotificationService.dismissOldestActive();
}
function removeOldestHistory() {
NotificationService.removeOldestHistory();
}
function dismissAll() {
NotificationService.dismissAllActive();
}
+13
View File
@@ -710,6 +710,19 @@ Singleton {
return false;
}
function removeOldestHistory() {
if (historyList.count > 0) {
const oldest = historyList.get(historyList.count - 1);
if (oldest.cachedImage && !oldest.cachedImage.startsWith("image://")) {
Quickshell.execDetached(["rm", "-f", oldest.cachedImage]);
}
historyList.remove(historyList.count - 1);
saveHistory();
return true;
}
return false;
}
function clearHistory() {
try {
Quickshell.execDetached(["sh", "-c", `rm -rf "${Settings.cacheDirImagesNotifications}"*`]);