diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-20 21:25:22 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-20 21:25:22 +1000 |
| commit | 16ce222ad7c85b6e79f666e331ddc93fd3d00155 (patch) | |
| tree | b200a4742d4ad1d81a0d4504fdb2e7e851a96452 | |
| parent | sidebar/notifs: better count anim (diff) | |
| download | caelestia-shell-16ce222ad7c85b6e79f666e331ddc93fd3d00155.tar.gz caelestia-shell-16ce222ad7c85b6e79f666e331ddc93fd3d00155.tar.bz2 caelestia-shell-16ce222ad7c85b6e79f666e331ddc93fd3d00155.zip | |
sidebar/notifs: fix minor bugs
Image/app icon/urgency/time not updating until corresponding notif is fully destroyed
Weird array mutation shenanigans
| -rw-r--r-- | modules/sidebar/NotifGroup.qml | 8 | ||||
| -rw-r--r-- | services/Notifs.qml | 10 |
2 files changed, 7 insertions, 11 deletions
diff --git a/modules/sidebar/NotifGroup.qml b/modules/sidebar/NotifGroup.qml index 95b1f4a..c974ce3 100644 --- a/modules/sidebar/NotifGroup.qml +++ b/modules/sidebar/NotifGroup.qml @@ -19,9 +19,9 @@ StyledRect { readonly property list<var> notifs: Notifs.list.filter(n => n.appName === modelData) readonly property int notifCount: notifs.reduce((acc, n) => n.closed ? acc : acc + 1, 0) - readonly property string image: notifs.find(n => n.image.length > 0)?.image ?? "" - readonly property string appIcon: notifs.find(n => n.appIcon.length > 0)?.appIcon ?? "" - readonly property int urgency: notifs.some(n => n.urgency === NotificationUrgency.Critical) ? NotificationUrgency.Critical : notifs.some(n => n.urgency === NotificationUrgency.Normal) ? NotificationUrgency.Normal : NotificationUrgency.Low + readonly property string image: notifs.find(n => !n.closed && n.image.length > 0)?.image ?? "" + readonly property string appIcon: notifs.find(n => !n.closed && n.appIcon.length > 0)?.appIcon ?? "" + readonly property int urgency: notifs.some(n => !n.closed && n.urgency === NotificationUrgency.Critical) ? NotificationUrgency.Critical : notifs.some(n => n.urgency === NotificationUrgency.Normal) ? NotificationUrgency.Normal : NotificationUrgency.Low readonly property int nonAnimHeight: { const headerHeight = header.implicitHeight + (root.expanded ? Math.round(Appearance.spacing.small / 2) : 0); @@ -162,7 +162,7 @@ StyledRect { StyledText { animate: true - text: root.notifs[0]?.timeStr ?? "" + text: root.notifs.find(n => !n.closed)?.timeStr ?? "" color: Colours.palette.m3outline font.pointSize: Appearance.font.size.small } diff --git a/services/Notifs.qml b/services/Notifs.qml index 1de3805..3a81c5f 100644 --- a/services/Notifs.qml +++ b/services/Notifs.qml @@ -274,18 +274,14 @@ Singleton { function unlock(item: Item): void { locks.delete(item); - - if (closed && locks.size === 0 && root.list.includes(this)) { - root.list.splice(root.list.indexOf(this), 1); - notification?.dismiss(); - destroy(); - } + if (closed) + close(); } function close(): void { closed = true; if (locks.size === 0 && root.list.includes(this)) { - root.list.splice(root.list.indexOf(this), 1); + root.list = root.list.filter(n => n !== this); notification?.dismiss(); destroy(); } |