From 643b197d02c65a1895d679a8d2ca068a5a8e94af Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 7 Jun 2025 14:10:31 +0200 Subject: [PATCH] notifications: fix spacing/eliding --- .../common/widgets/NotificationGroup.qml | 66 +++++++++++-------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/.config/quickshell/modules/common/widgets/NotificationGroup.qml b/.config/quickshell/modules/common/widgets/NotificationGroup.qml index 009a0b3ed..cfe93327c 100644 --- a/.config/quickshell/modules/common/widgets/NotificationGroup.qml +++ b/.config/quickshell/modules/common/widgets/NotificationGroup.qml @@ -154,42 +154,56 @@ Item { // Notification group area ColumnLayout { // Content Layout.fillWidth: true - spacing: expanded ? - ((root.multipleNotifications && - notificationGroup?.notifications[root.notificationCount - 1].image != "") ? 35 : - 5) : 0 + spacing: expanded ? (root.multipleNotifications ? + (notificationGroup?.notifications[root.notificationCount - 1].image != "") ? 35 : + 5 : 0) : 0 + // spacing: 00 Behavior on spacing { animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) } - RowLayout { // App name (or summary when there's only 1 notif) and time + Item { // App name (or summary when there's only 1 notif) and time id: topRow - spacing: 0 + // spacing: 0 + Layout.fillWidth: true property real fontSize: Appearance.font.pixelSize.smaller property bool showAppName: root.multipleNotifications + implicitHeight: Math.max(topTextRow.implicitHeight, expandButton.implicitHeight) - StyledText { - id: appName - text: (topRow.showAppName ? - notificationGroup?.appName : - notificationGroup?.notifications[0]?.summary) || "" - font.pixelSize: topRow.showAppName ? - topRow.fontSize : - Appearance.font.pixelSize.small - color: topRow.showAppName ? - Appearance.colors.colSubtext : - Appearance.colors.colOnLayer2 + RowLayout { + id: topTextRow + anchors.left: parent.left + anchors.right: expandButton.left + anchors.verticalCenter: parent.verticalCenter + spacing: 5 + StyledText { + id: appName + elide: Text.ElideRight + Layout.fillWidth: true + text: (topRow.showAppName ? + notificationGroup?.appName : + notificationGroup?.notifications[0]?.summary) || "" + font.pixelSize: topRow.showAppName ? + topRow.fontSize : + Appearance.font.pixelSize.small + color: topRow.showAppName ? + Appearance.colors.colSubtext : + Appearance.colors.colOnLayer2 + } + StyledText { + id: timeText + // Layout.fillWidth: true + Layout.rightMargin: 10 + horizontalAlignment: Text.AlignLeft + text: NotificationUtils.getFriendlyNotifTimeString(notificationGroup?.time) + font.pixelSize: topRow.fontSize + color: Appearance.colors.colSubtext + } } - StyledText { - id: timeText - text: " • " + NotificationUtils.getFriendlyNotifTimeString(notificationGroup?.time) - font.pixelSize: topRow.fontSize - color: Appearance.colors.colSubtext - Layout.alignment: Qt.AlignRight - Layout.fillWidth: true - } - Item { Layout.fillWidth: true } NotificationGroupExpandButton { + id: expandButton + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter count: root.notificationCount expanded: root.expanded fontSize: topRow.fontSize