diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-13 14:56:55 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-13 14:56:55 +0200 |
| commit | 3ce3fe19b11e30fd98d7eee06d56b90ae33b228d (patch) | |
| tree | 572e904f871cd05410c21b33ddf9e0ae7e1c5c90 /accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml | |
| parent | 666464567055a2e4ba9f6bb310e901cdc27977f7 (diff) | |
| download | nixos-3ce3fe19b11e30fd98d7eee06d56b90ae33b228d.tar nixos-3ce3fe19b11e30fd98d7eee06d56b90ae33b228d.tar.gz nixos-3ce3fe19b11e30fd98d7eee06d56b90ae33b228d.tar.bz2 nixos-3ce3fe19b11e30fd98d7eee06d56b90ae33b228d.tar.xz nixos-3ce3fe19b11e30fd98d7eee06d56b90ae33b228d.zip | |
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml')
| -rw-r--r-- | accounts/gkleen@sif/shell/quickshell/NotificationDisplay.qml | 40 |
1 files changed, 35 insertions, 5 deletions
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 { | |||
| 15 | id: notifsRepeater | 15 | id: notifsRepeater |
| 16 | 16 | ||
| 17 | model: ScriptModel { | 17 | model: ScriptModel { |
| 18 | values: NotificationManager.displayInhibited ? [] : [...NotificationManager.groups] | 18 | values: NotificationManager.displayInhibited ? [] : NotificationManager.groups |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | delegate: PanelWindow { | 21 | delegate: PanelWindow { |
| @@ -48,6 +48,7 @@ Scope { | |||
| 48 | readonly property real spaceAbove: { | 48 | readonly property real spaceAbove: { |
| 49 | var res = 0; | 49 | var res = 0; |
| 50 | for (let i = 0; i < notifWindow.index; i++) { | 50 | for (let i = 0; i < notifWindow.index; i++) { |
| 51 | (_ => {})(notifsRepeater.objectAt(i).modelData); | ||
| 51 | res += notifsRepeater.objectAt(i).height + 8; | 52 | res += notifsRepeater.objectAt(i).height + 8; |
| 52 | } | 53 | } |
| 53 | return res; | 54 | return res; |
| @@ -60,7 +61,7 @@ Scope { | |||
| 60 | 61 | ||
| 61 | color: "transparent" | 62 | color: "transparent" |
| 62 | 63 | ||
| 63 | implicitHeight: Math.max(notifCount.visible ? notifCount.contentHeight : 0, notifSummary.contentHeight) + (notifBody.visible ? 8 + notifBody.contentHeight : 0) + (notifActions.visible ? 8 + notifActions.height : 0) + 16 | 64 | 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 |
| 64 | implicitWidth: 400 | 65 | implicitWidth: 400 |
| 65 | 66 | ||
| 66 | WrapperMouseArea { | 67 | WrapperMouseArea { |
| @@ -108,6 +109,8 @@ Scope { | |||
| 108 | res += 1; | 109 | res += 1; |
| 109 | if (notifActions.visible) | 110 | if (notifActions.visible) |
| 110 | res += 1; | 111 | res += 1; |
| 112 | if (notifTime.visible) | ||
| 113 | res += 1; | ||
| 111 | return res; | 114 | return res; |
| 112 | } | 115 | } |
| 113 | 116 | ||
| @@ -167,7 +170,7 @@ Scope { | |||
| 167 | Layout.column: 0 | 170 | Layout.column: 0 |
| 168 | Layout.row: 0 | 171 | Layout.row: 0 |
| 169 | Layout.fillHeight: true | 172 | Layout.fillHeight: true |
| 170 | Layout.rowSpan: notifBody.visible ? 2 : 1 | 173 | Layout.rowSpan: 1 + (notifBody.visible ? 1 : 0) + (notifTime.visible ? 1 : 0) |
| 171 | } | 174 | } |
| 172 | 175 | ||
| 173 | Text { | 176 | Text { |
| @@ -176,6 +179,7 @@ Scope { | |||
| 176 | visible: notifWindow.modelData?.[notifWindow.activeIx]?.body ?? false | 179 | visible: notifWindow.modelData?.[notifWindow.activeIx]?.body ?? false |
| 177 | text: notifWindow.modelData?.[notifWindow.activeIx]?.body ?? "" | 180 | text: notifWindow.modelData?.[notifWindow.activeIx]?.body ?? "" |
| 178 | textFormat: Text.RichText | 181 | textFormat: Text.RichText |
| 182 | wrapMode: Text.Wrap | ||
| 179 | 183 | ||
| 180 | font.pointSize: 10 | 184 | font.pointSize: 10 |
| 181 | font.family: "Fira Sans" | 185 | font.family: "Fira Sans" |
| @@ -187,6 +191,32 @@ Scope { | |||
| 187 | Layout.columnSpan: notifCount.visible ? 2 : 1 | 191 | Layout.columnSpan: notifCount.visible ? 2 : 1 |
| 188 | } | 192 | } |
| 189 | 193 | ||
| 194 | Text { | ||
| 195 | id: notifTime | ||
| 196 | |||
| 197 | Connections { | ||
| 198 | target: NotificationManager.clock | ||
| 199 | function onDateChanged() { | ||
| 200 | notifTime.text = NotificationManager.formatTime(notifWindow.modelData?.[notifWindow.activeIx]?.receivedTime); | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | visible: notifTime.text && notifTime.text !== "now" | ||
| 205 | text: NotificationManager.formatTime(notifWindow.modelData?.[notifWindow.activeIx]?.receivedTime) | ||
| 206 | |||
| 207 | font.pointSize: 8 | ||
| 208 | font.family: "Fira Sans" | ||
| 209 | font.italic: true | ||
| 210 | color: "#555" | ||
| 211 | maximumLineCount: 1 | ||
| 212 | horizontalAlignment: Text.AlignRight | ||
| 213 | |||
| 214 | Layout.fillWidth: true | ||
| 215 | Layout.row: notifBody.visible ? 2 : 1 | ||
| 216 | Layout.column: notifImage.visible ? 1 : 0 | ||
| 217 | Layout.columnSpan: 2 | ||
| 218 | } | ||
| 219 | |||
| 190 | RowLayout { | 220 | RowLayout { |
| 191 | id: notifActions | 221 | id: notifActions |
| 192 | 222 | ||
| @@ -196,9 +226,9 @@ Scope { | |||
| 196 | uniformCellSizes: true | 226 | uniformCellSizes: true |
| 197 | 227 | ||
| 198 | width: 400 - 16 | 228 | width: 400 - 16 |
| 199 | Layout.row: notifBody.visible ? 2 : 1 | 229 | Layout.row: 1 + (notifBody.visible ? 1 : 0) + (notifTime.visible ? 1 : 0) |
| 200 | Layout.column: 0 | 230 | Layout.column: 0 |
| 201 | Layout.columnSpan: notifImage.visible ? 3 : 2 | 231 | Layout.columnSpan: 2 + (notifImage.visible ? 1 : 0) |
| 202 | 232 | ||
| 203 | Repeater { | 233 | Repeater { |
| 204 | model: ScriptModel { | 234 | model: ScriptModel { |
