From 6394fe049d2cdee7c8c329509070dca5db2ecc5e Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 26 Sep 2025 22:55:14 +0200 Subject: [PATCH] notifications: prevent summaries from spilling --- .../ii/modules/common/widgets/NotificationItem.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.config/quickshell/ii/modules/common/widgets/NotificationItem.qml b/.config/quickshell/ii/modules/common/widgets/NotificationItem.qml index 4f87b4fdd..3aafdc400 100644 --- a/.config/quickshell/ii/modules/common/widgets/NotificationItem.qml +++ b/.config/quickshell/ii/modules/common/widgets/NotificationItem.qml @@ -16,6 +16,7 @@ Item { // Notification item area property bool onlyNotification: false property real fontSize: Appearance.font.pixelSize.small property real padding: onlyNotification ? 0 : 8 + property real summaryElideRatio: 0.85 property real dragConfirmThreshold: 70 // Drag further to discard notification property real dismissOvershoot: notificationIcon.implicitWidth + 20 // Account for gaps and bouncy animations @@ -58,6 +59,12 @@ Item { // Notification item area destroyAnimation.running = true; } + TextMetrics { + id: summaryTextMetrics + font.pixelSize: root.fontSize + text: root.notificationObject.summary || "" + } + SequentialAnimation { // Drag finish animation id: destroyAnimation running: false @@ -164,9 +171,9 @@ Item { // Notification item area visible: !root.onlyNotification || !root.expanded Layout.fillWidth: true implicitHeight: summaryText.implicitHeight - // Layout.fillWidth: true StyledText { id: summaryText + Layout.fillWidth: summaryTextMetrics.width >= summaryRow.width * root.summaryElideRatio visible: !root.onlyNotification font.pixelSize: root.fontSize color: Appearance.colors.colOnLayer3