From 0fce9672f1e4cea70bd41a292ea07e0a9fca4508 Mon Sep 17 00:00:00 2001 From: SomeElse Date: Mon, 27 Apr 2026 08:41:02 +0000 Subject: [PATCH] fixed notifications popup menu reserving too much space for the next card --- bar/modules/Notifications.qml | 25 +++++++------- config/themes/goldencity.qml | 2 +- notifications/NotificationCard.qml | 52 ++++++++++++++++++------------ 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/bar/modules/Notifications.qml b/bar/modules/Notifications.qml index e2dc57b..8dbbc94 100644 --- a/bar/modules/Notifications.qml +++ b/bar/modules/Notifications.qml @@ -208,18 +208,19 @@ Rectangle { Repeater { model: activeToasts Notif.NotificationCard { - width: toastCol.width - toastId: model.toastId - appName: model.appName - summary: model.summary - body: model.body - urgency: model.urgency - timeStr: model.timeStr - timeout: model.timeout - t: root.t - urgencyColor: root.urgencyColor - urgencyIcon: root.urgencyIcon - onDismissed: (id) => root.removeToast(id) + width: toastCol.width + toastId: model.toastId + appName: model.appName + summary: model.summary + body: model.body + urgency: model.urgency + timeStr: model.timeStr + timeout: model.timeout + t: root.t + urgencyColor: root.urgencyColor + urgencyIcon: root.urgencyIcon + slideFromRight: toastLayer.atRight + onDismissed: (id) => root.removeToast(id) } } } diff --git a/config/themes/goldencity.qml b/config/themes/goldencity.qml index f33f9e2..643750b 100644 --- a/config/themes/goldencity.qml +++ b/config/themes/goldencity.qml @@ -154,7 +154,7 @@ QtObject { // ── History popup ────────────────────────────────────────────────────────── readonly property color notifHistoryBg: bgPopup - readonly property color notifHistoryBorder: "#44c19375" + readonly property color notifHistoryBorder: borderPopup readonly property color notifHistoryShadow: "#aa000000" readonly property color notifHistoryHover: "#11c19375" readonly property color notifHistoryEmpty: textDim diff --git a/notifications/NotificationCard.qml b/notifications/NotificationCard.qml index bb5ce55..ad430f7 100644 --- a/notifications/NotificationCard.qml +++ b/notifications/NotificationCard.qml @@ -25,12 +25,41 @@ Item { height: toastCard.height property real progressVal: 1.0 + property bool slideFromRight: false + + property real slideX: slideFromRight ? (width + 20) : -(width + 20) + + transform: Translate { id: slideTranslate; x: root.slideX } + + Component.onCompleted: entranceSlide.start() + + NumberAnimation { + id: entranceSlide + target: slideTranslate; property: "x" + from: root.slideX; to: 0 + duration: 300; easing.type: Easing.OutCubic + } + + function triggerDismiss() { + if (exitSlide.running) return + autoTimer.stop() + exitSlide.start() + } + + NumberAnimation { + id: exitSlide + target: slideTranslate; property: "x" + to: root.slideX + duration: 220; easing.type: Easing.InCubic + onStopped: root.dismissed(root.toastId) + } Timer { + id: autoTimer interval: root.timeout running: root.timeout > 0 repeat: false - onTriggered: root.dismissed(root.toastId) + onTriggered: root.triggerDismiss() } NumberAnimation on progressVal { @@ -39,23 +68,6 @@ Item { running: root.urgency === NotificationUrgency.Low && root.timeout > 0 } - opacity: 0 - scale: 0.90 - Component.onCompleted: { - entranceOp.start() - entranceSc.start() - } - NumberAnimation { - id: entranceOp; target: root - property: "opacity"; from: 0; to: 1 - duration: 240; easing.type: Easing.OutCubic - } - NumberAnimation { - id: entranceSc; target: root - property: "scale"; from: 0.90; to: 1.0 - duration: 240; easing.type: Easing.OutBack - } - Rectangle { id: toastCard width: parent.width @@ -73,7 +85,7 @@ Item { Behavior on border.color { ColorAnimation { duration: 150 } } HoverHandler { id: cardHover } - TapHandler { onTapped: root.dismissed(root.toastId) } + TapHandler { onTapped: root.triggerDismiss() } Rectangle { width: 4 @@ -139,7 +151,7 @@ Item { font.pixelSize: 10 } HoverHandler { id: closeHover; cursorShape: Qt.PointingHandCursor } - TapHandler { onTapped: root.dismissed(root.toastId) } + TapHandler { onTapped: root.triggerDismiss() } } }