diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-20 20:54:34 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-20 20:54:34 +1000 |
| commit | 1a1145f2f446959073769ab9571cefc0d947d3cb (patch) | |
| tree | 8dd9350693c35ce2d875100f8f0a93e9f2afb0cd /modules/sidebar/NotifDock.qml | |
| parent | readme: fix example config (#652) (diff) | |
| download | caelestia-shell-1a1145f2f446959073769ab9571cefc0d947d3cb.tar.gz caelestia-shell-1a1145f2f446959073769ab9571cefc0d947d3cb.tar.bz2 caelestia-shell-1a1145f2f446959073769ab9571cefc0d947d3cb.zip | |
sidebar/notifs: better count anim
Diffstat (limited to 'modules/sidebar/NotifDock.qml')
| -rw-r--r-- | modules/sidebar/NotifDock.qml | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/modules/sidebar/NotifDock.qml b/modules/sidebar/NotifDock.qml index 7c71da8..219ae7c 100644 --- a/modules/sidebar/NotifDock.qml +++ b/modules/sidebar/NotifDock.qml @@ -22,7 +22,7 @@ Item { Component.onCompleted: Notifs.list.forEach(n => n.popup = false) - StyledText { + Item { id: title anchors.top: parent.top @@ -30,12 +30,46 @@ Item { anchors.right: parent.right anchors.margins: Appearance.padding.small - 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 - font.weight: 500 - elide: Text.ElideRight + implicitHeight: Math.max(count.implicitHeight, titleText.implicitHeight) + + StyledText { + id: count + + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: root.notifCount > 0 ? 0 : -width - titleText.anchors.leftMargin + opacity: root.notifCount > 0 ? 1 : 0 + + text: root.notifCount + color: Colours.palette.m3outline + font.pointSize: Appearance.font.size.normal + font.family: Appearance.font.family.mono + font.weight: 500 + + Behavior on anchors.leftMargin { + Anim {} + } + + Behavior on opacity { + Anim {} + } + } + + StyledText { + id: titleText + + anchors.verticalCenter: parent.verticalCenter + anchors.left: count.right + anchors.right: parent.right + anchors.leftMargin: Appearance.spacing.small + + text: root.notifCount > 0 ? qsTr("notification%1").arg(root.notifCount === 1 ? "" : "s") : qsTr("Notifications") + color: Colours.palette.m3outline + font.pointSize: Appearance.font.size.normal + font.family: Appearance.font.family.mono + font.weight: 500 + elide: Text.ElideRight + } } ClippingRectangle { |