From 3ce3fe19b11e30fd98d7eee06d56b90ae33b228d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 13 Sep 2025 14:56:55 +0200 Subject: ... --- .../shell/quickshell/NotificationDisplay.qml | 40 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml') diff --git a/accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml b/accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml index 589c36e5..a727b044 100644 --- a/accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml +++ b/accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml @@ -15,7 +15,7 @@ Scope { id: notifsRepeater model: ScriptModel { - values: NotificationManager.displayInhibited ? [] : [...NotificationManager.groups] + values: NotificationManager.displayInhibited ? [] : NotificationManager.groups } delegate: PanelWindow { @@ -48,6 +48,7 @@ Scope { readonly property real spaceAbove: { var res = 0; for (let i = 0; i < notifWindow.index; i++) { + (_ => {})(notifsRepeater.objectAt(i).modelData); res += notifsRepeater.objectAt(i).height + 8; } return res; @@ -60,7 +61,7 @@ Scope { color: "transparent" - implicitHeight: Math.max(notifCount.visible ? notifCount.contentHeight : 0, notifSummary.contentHeight) + (notifBody.visible ? 8 + notifBody.contentHeight : 0) + (notifActions.visible ? 8 + notifActions.height : 0) + 16 + implicitHeight: Math.max(notifCount.visible ? notifCount.contentHeight : 0, notifSummary.contentHeight) + (notifBody.visible ? 8 + notifBody.contentHeight : 0) + (notifActions.visible ? 8 + notifActions.height : 0) + (notifTime.visible ? 8 + notifTime.contentHeight : 0) + 16 implicitWidth: 400 WrapperMouseArea { @@ -108,6 +109,8 @@ Scope { res += 1; if (notifActions.visible) res += 1; + if (notifTime.visible) + res += 1; return res; } @@ -167,7 +170,7 @@ Scope { Layout.column: 0 Layout.row: 0 Layout.fillHeight: true - Layout.rowSpan: notifBody.visible ? 2 : 1 + Layout.rowSpan: 1 + (notifBody.visible ? 1 : 0) + (notifTime.visible ? 1 : 0) } Text { @@ -176,6 +179,7 @@ Scope { visible: notifWindow.modelData?.[notifWindow.activeIx]?.body ?? false text: notifWindow.modelData?.[notifWindow.activeIx]?.body ?? "" textFormat: Text.RichText + wrapMode: Text.Wrap font.pointSize: 10 font.family: "Fira Sans" @@ -187,6 +191,32 @@ Scope { Layout.columnSpan: notifCount.visible ? 2 : 1 } + Text { + id: notifTime + + Connections { + target: NotificationManager.clock + function onDateChanged() { + notifTime.text = NotificationManager.formatTime(notifWindow.modelData?.[notifWindow.activeIx]?.receivedTime); + } + } + + visible: notifTime.text && notifTime.text !== "now" + text: NotificationManager.formatTime(notifWindow.modelData?.[notifWindow.activeIx]?.receivedTime) + + font.pointSize: 8 + font.family: "Fira Sans" + font.italic: true + color: "#555" + maximumLineCount: 1 + horizontalAlignment: Text.AlignRight + + Layout.fillWidth: true + Layout.row: notifBody.visible ? 2 : 1 + Layout.column: notifImage.visible ? 1 : 0 + Layout.columnSpan: 2 + } + RowLayout { id: notifActions @@ -196,9 +226,9 @@ Scope { uniformCellSizes: true width: 400 - 16 - Layout.row: notifBody.visible ? 2 : 1 + Layout.row: 1 + (notifBody.visible ? 1 : 0) + (notifTime.visible ? 1 : 0) Layout.column: 0 - Layout.columnSpan: notifImage.visible ? 3 : 2 + Layout.columnSpan: 2 + (notifImage.visible ? 1 : 0) Repeater { model: ScriptModel { -- cgit v1.2.3