Formatting

This commit is contained in:
quadbyte 2025-08-13 08:05:29 -04:00
parent c49e59220a
commit a57f2f5d68
8 changed files with 132 additions and 130 deletions

View file

@ -57,7 +57,8 @@ QtObject {
property int maxHistory: 100
// Cached history file path
property string historyFile: Quickshell.env("NOCTALIA_NOTIF_HISTORY_FILE") || (Settings.cacheDir + "notifications.json")
property string historyFile: Quickshell.env("NOCTALIA_NOTIF_HISTORY_FILE")
|| (Settings.cacheDir + "notifications.json")
// Persisted storage for history
property FileView historyFileView: FileView {
@ -130,12 +131,12 @@ QtObject {
// Add a simplified copy into persistent history
function addToHistory(notification) {
historyModel.insert(0, {
"summary": notification.summary,
"body": notification.body,
"appName": notification.appName,
"urgency": notification.urgency,
"timestamp": new Date()
})
"summary": notification.summary,
"body": notification.body,
"appName": notification.appName,
"urgency": notification.urgency,
"timestamp": new Date()
})
while (historyModel.count > maxHistory) {
historyModel.remove(historyModel.count - 1)
}
@ -155,12 +156,12 @@ QtObject {
for (var i = 0; i < items.length; i++) {
const it = items[i]
historyModel.append({
"summary": it.summary || "",
"body": it.body || "",
"appName": it.appName || "",
"urgency": it.urgency,
"timestamp": it.timestamp ? new Date(it.timestamp) : new Date()
})
"summary": it.summary || "",
"body": it.body || "",
"appName": it.appName || "",
"urgency": it.urgency,
"timestamp": it.timestamp ? new Date(it.timestamp) : new Date()
})
}
} catch (e) {
console.error("[Notifications] Failed to load history:", e)
@ -174,11 +175,11 @@ QtObject {
for (var i = 0; i < historyModel.count; i++) {
const n = historyModel.get(i)
arr.push({
summary: n.summary,
body: n.body,
appName: n.appName,
urgency: n.urgency,
timestamp: (n.timestamp instanceof Date) ? n.timestamp.getTime() : n.timestamp
"summary": n.summary,
"body": n.body,
"appName": n.appName,
"urgency": n.urgency,
"timestamp": (n.timestamp instanceof Date) ? n.timestamp.getTime() : n.timestamp
})
}
historyAdapter.history = arr