From eab211b28952cc4875c80aeeccfa6b3c0322b4f3 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 19 Sep 2025 22:47:15 +1000 Subject: sidebar/notifs: fix count updating --- modules/sidebar/NotifDock.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/sidebar/NotifDock.qml b/modules/sidebar/NotifDock.qml index c34229e..6ec8581 100644 --- a/modules/sidebar/NotifDock.qml +++ b/modules/sidebar/NotifDock.qml @@ -15,6 +15,7 @@ Item { id: root required property Props props + readonly property int notifCount: Notifs.list.reduce((acc, n) => n.closed ? acc : acc + 1, 0) anchors.fill: parent anchors.margins: Appearance.padding.normal @@ -29,7 +30,7 @@ Item { anchors.right: parent.right anchors.margins: Appearance.padding.small - text: Notifs.list.length > 0 ? qsTr("%1 notification%2").arg(Notifs.list.length).arg(Notifs.list.length === 1 ? "" : "s") : qsTr("Notifications") + text: root.notifCount > 0 ? qsTr("%1 notification%2").arg(root.notifCount).arg(root.notifCount === 1 ? "" : "s") : qsTr("Notifications") color: Colours.palette.m3outline font.pointSize: Appearance.font.size.normal font.family: Appearance.font.family.mono @@ -53,7 +54,7 @@ Item { anchors.centerIn: parent asynchronous: true active: opacity > 0 - opacity: Notifs.list.length > 0 ? 0 : 1 + opacity: root.notifCount > 0 ? 0 : 1 sourceComponent: ColumnLayout { spacing: Appearance.spacing.large @@ -216,7 +217,7 @@ Item { repeat: true interval: 50 onTriggered: { - if (Notifs.list.length > 0) + if (root.notifCount > 0) Notifs.list[0].close(); else stop(); @@ -228,8 +229,8 @@ Item { anchors.bottom: parent.bottom anchors.margins: Appearance.padding.normal - scale: Notifs.list.length > 0 ? 1 : 0.5 - opacity: Notifs.list.length > 0 ? 1 : 0 + scale: root.notifCount > 0 ? 1 : 0.5 + opacity: root.notifCount > 0 ? 1 : 0 active: opacity > 0 sourceComponent: IconButton { -- cgit v1.2.3-freya