diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-29 23:37:02 +0800 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-29 23:37:02 +0800 |
| commit | dc1b01ccd34780a3d2fcae0eee53910958d2adab (patch) | |
| tree | 8dbd212747c15d47b7ef18c44a0a74d71811847f /modules | |
| parent | systemusage: actually run gpu procs (diff) | |
| download | caelestia-shell-dc1b01ccd34780a3d2fcae0eee53910958d2adab.tar.gz caelestia-shell-dc1b01ccd34780a3d2fcae0eee53910958d2adab.tar.bz2 caelestia-shell-dc1b01ccd34780a3d2fcae0eee53910958d2adab.zip | |
notifs: fix opening anim when spam notifs
No open/close state, just animate height
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/drawers/Drawers.qml | 1 | ||||
| -rw-r--r-- | modules/drawers/Panels.qml | 2 | ||||
| -rw-r--r-- | modules/notifications/Content.qml | 69 | ||||
| -rw-r--r-- | modules/notifications/Wrapper.qml | 24 |
4 files changed, 36 insertions, 60 deletions
diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index 985f83e..fab1995 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -105,7 +105,6 @@ Variants { id: visibilities property bool osd - property bool notifications: Notifs.popups.length > 0 property bool session property bool launcher property bool dashboard diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml index db97362..5ea7e83 100644 --- a/modules/drawers/Panels.qml +++ b/modules/drawers/Panels.qml @@ -40,8 +40,6 @@ Item { Notifications.Wrapper { id: notifications - visibility: root.visibilities.notifications - anchors.top: parent.top anchors.right: parent.right } diff --git a/modules/notifications/Content.qml b/modules/notifications/Content.qml index 5cd566e..1f7361a 100644 --- a/modules/notifications/Content.qml +++ b/modules/notifications/Content.qml @@ -10,16 +10,42 @@ Item { readonly property int padding: Appearance.padding.large + anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right - implicitWidth: NotifsConfig.sizes.width + root.padding * 2 - implicitHeight: list.implicitHeight + root.padding * 2 + implicitWidth: NotifsConfig.sizes.width + padding * 2 + implicitHeight: { + const count = list.count; + if (count === 0) + return 0; + + let height = (count - 1) * list.spacing; + for (let i = 0; i < count; i++) + height += list.itemAtIndex(i)?.nonAnimHeight ?? 0; + + const screen = QsWindow.window?.screen; + const visibilities = Visibilities.screens[screen]; + const panel = Visibilities.panels[screen]; + if (visibilities && panel) { + if (visibilities.osd) { + const h = panel.osd.y - BorderConfig.rounding * 2; + if (height > h) + height = h; + } + + if (visibilities.session) { + const h = panel.session.y - BorderConfig.rounding * 2; + if (height > h) + height = h; + } + } + + return Math.min((screen?.height ?? 0) - BorderConfig.thickness * 2, height + padding * 2); + } ClippingWrapperRectangle { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + anchors.fill: parent anchors.margins: root.padding color: "transparent" @@ -34,31 +60,6 @@ Item { anchors.fill: parent - implicitHeight: { - let height = (count - 1) * spacing; - for (let i = 0; i < count; i++) - height += itemAtIndex(i)?.nonAnimHeight ?? 0; - - const screen = QsWindow.window?.screen; - const visibilities = Visibilities.screens[screen]; - const panel = Visibilities.panels[screen]; - if (visibilities && panel) { - if (visibilities.osd) { - const h = panel.osd.y - BorderConfig.rounding * 2; - if (height > h) - height = h; - } - - if (visibilities.session) { - const h = panel.session.y - BorderConfig.rounding * 2; - if (height > h) - height = h; - } - } - - return Math.max(61, Math.min((screen?.height ?? 0) - root.padding * 2 - BorderConfig.thickness * 2, height)); - } - orientation: Qt.Vertical spacing: Appearance.spacing.smaller cacheBuffer: QsWindow.window?.screen.height ?? 0 @@ -92,13 +93,13 @@ Item { property: "y" } } - - Behavior on implicitHeight { - Anim {} - } } } + Behavior on implicitHeight { + Anim {} + } + component Anim: NumberAnimation { duration: Appearance.anim.durations.expressiveDefaultSpatial easing.type: Easing.BezierSpline diff --git a/modules/notifications/Wrapper.qml b/modules/notifications/Wrapper.qml index 4153b6b..a3a2631 100644 --- a/modules/notifications/Wrapper.qml +++ b/modules/notifications/Wrapper.qml @@ -1,35 +1,13 @@ import "root:/config" -import Quickshell import QtQuick Item { id: root - required property bool visibility - visible: height > 0 - implicitHeight: 0 + implicitHeight: content.implicitHeight implicitWidth: content.implicitWidth + BorderConfig.rounding - states: State { - name: "visible" - when: root.visibility - - PropertyChanges { - root.implicitHeight: content.implicitHeight - } - } - - transitions: Transition { - NumberAnimation { - target: root - property: "implicitHeight" - duration: Appearance.anim.durations.expressiveDefaultSpatial - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial - } - } - Content { id: content } |