From 4fc275bead670d5485a7cfb0402e38057efe6443 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 12 Feb 2026 23:27:34 -0500 Subject: [PATCH] notification: expand/collapse animation adjustment --- quickshell/Common/Theme.qml | 4 ++-- .../KeyboardNavigatedNotificationList.qml | 24 ++++++++++++++++++- .../Notifications/Center/NotificationCard.qml | 2 +- .../Center/NotificationCenterPopout.qml | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/quickshell/Common/Theme.qml b/quickshell/Common/Theme.qml index 13db0126..f905ffc4 100644 --- a/quickshell/Common/Theme.qml +++ b/quickshell/Common/Theme.qml @@ -799,12 +799,12 @@ Singleton { readonly property int notificationExpandDuration: { const base = notificationAnimationBaseDuration; - return base === 0 ? 0 : Math.round(base * 1.4); + return base === 0 ? 0 : Math.round(base * 1.0); } readonly property int notificationCollapseDuration: { const base = notificationAnimationBaseDuration; - return base === 0 ? 0 : Math.round(base * 1.1); + return base === 0 ? 0 : Math.round(base * 0.85); } readonly property int popoutAnimationDuration: { diff --git a/quickshell/Modules/Notifications/Center/KeyboardNavigatedNotificationList.qml b/quickshell/Modules/Notifications/Center/KeyboardNavigatedNotificationList.qml index cd03f9c0..fb9ee7ba 100644 --- a/quickshell/Modules/Notifications/Center/KeyboardNavigatedNotificationList.qml +++ b/quickshell/Modules/Notifications/Center/KeyboardNavigatedNotificationList.qml @@ -11,16 +11,38 @@ DankListView { property bool autoScrollDisabled: false property bool isAnimatingExpansion: false property alias listContentHeight: listView.contentHeight + property real stableContentHeight: 0 property bool cardAnimateExpansion: true property bool listInitialized: false Component.onCompleted: { Qt.callLater(() => { - if (listView) + if (listView) { listView.listInitialized = true; + listView.stableContentHeight = listView.contentHeight; + } }); } + onContentHeightChanged: { + if (!isAnimatingExpansion) + stableContentHeight = contentHeight; + } + + onIsAnimatingExpansionChanged: { + if (isAnimatingExpansion) { + let delta = 0; + for (let i = 0; i < count; i++) { + const item = itemAtIndex(i); + if (item && item.children[0] && item.children[0].isAnimating) + delta += item.children[0].targetHeight - item.height; + } + stableContentHeight = contentHeight + delta; + } else { + stableContentHeight = contentHeight; + } + } + clip: true model: NotificationService.groupedNotifications spacing: Theme.spacingL diff --git a/quickshell/Modules/Notifications/Center/NotificationCard.qml b/quickshell/Modules/Notifications/Center/NotificationCard.qml index ebe502f8..f1307b84 100644 --- a/quickshell/Modules/Notifications/Center/NotificationCard.qml +++ b/quickshell/Modules/Notifications/Center/NotificationCard.qml @@ -735,7 +735,7 @@ Rectangle { NumberAnimation { duration: root.expanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration easing.type: Easing.BezierSpline - easing.bezierCurve: root.expanded ? Theme.expressiveCurves.emphasizedDecel : Theme.expressiveCurves.emphasizedAccel + easing.bezierCurve: Theme.expressiveCurves.emphasized onRunningChanged: { if (running) { root.isAnimating = true; diff --git a/quickshell/Modules/Notifications/Center/NotificationCenterPopout.qml b/quickshell/Modules/Notifications/Center/NotificationCenterPopout.qml index 0a32baf6..b7f09fa3 100644 --- a/quickshell/Modules/Notifications/Center/NotificationCenterPopout.qml +++ b/quickshell/Modules/Notifications/Center/NotificationCenterPopout.qml @@ -113,7 +113,7 @@ DankPopout { baseHeight += Theme.spacingM * 2; const settingsHeight = notificationSettings.expanded ? notificationSettings.contentHeight : 0; - let listHeight = notificationHeader.currentTab === 0 ? notificationList.listContentHeight : Math.max(200, NotificationService.historyList.length * 80); + let listHeight = notificationHeader.currentTab === 0 ? notificationList.stableContentHeight : Math.max(200, NotificationService.historyList.length * 80); if (notificationHeader.currentTab === 0 && NotificationService.groupedNotifications.length === 0) { listHeight = 200; }