feat(notifs): handle transient notifications properly

Transient notifications are not persistently shown in the dashboard, and
thus permanently expire after their timer runs out.
This commit is contained in:
Kiana Sheibani 2025-10-08 13:07:06 -04:00
parent 3bb5e10d4d
commit a9dab6189d
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
3 changed files with 22 additions and 17 deletions

View file

@ -45,7 +45,7 @@ Singleton {
description: "Clear all notifications"
onPressed: {
for (const notif of root.list)
notif.popup = null;
notif.clear();
}
}
@ -93,13 +93,20 @@ Singleton {
// One-line version (for non-expanded notifications)
readonly property string bodyOneLine: notification.body.replace("\n", " ")
readonly property int expireTimeout: notification.expireTimeout > 0 ?
notification.expireTimeout : Config.notifs.defaultExpireTimeout
readonly property Timer timer: Timer {
running: true
interval: notif.notification.expireTimeout > 0 ? notif.notification.expireTimeout : Config.notifs.defaultExpireTimeout
onTriggered: {
if (Config.notifs.expire)
notif.popup = null;
}
interval: notif.expireTimeout
onTriggered: notif.clear()
}
function clear(): void {
if (notification.transient)
notification.expire();
else
popup = null;
}
readonly property Connections conn: Connections {