repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

notifications: scrollable history, toast drain bar, fix missing icon

bf6285c6b9b63d88e6ad0388720105c5eb61382b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Three issues surfaced during interactive testing:

- Popup history overflowed the fixed-height popout with no way to reach
  older notifications. Header now stays fixed; groups live in a
  height-bounded Flickable (the Loader forces a concrete root.height) with
  a slim overlaid scroll indicator shown only on overflow.

- Toasts with a finite timeout gave no sense of remaining time. A thin
  accent bar now drains across the card's bottom edge over timeoutMs;
  sticky/critical (timeoutMs 0) show none, lowPowerMode shows it static.

- notify-send funnels BOTH named freedesktop icons and attached photos
  into `image` as an image://icon/ provider URL (appIcon stays empty), so
  the card's appIcon-only icon slot rendered nothing. Split by source: a
  named icon shows as the small identity glyph (IconImage), a real picture
  (absolute path / raster extension) shows as the large preview, with the
  path form rewritten to file:// for correct aspect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Changed files (3)

quickshell/nuguland/NotificationCard.qml

Modified
10 10 signal dismiss(string id)
11 11 signal invokeAction(string id, string actionId)
13 + // notify-send funnels BOTH named freedesktop icons and attached photos into
14 + // `image` as an image://icon/ provider URL (appIcon stays empty). Split them:
15 + // a real picture (absolute path = double slash, or raster extension) renders
16 + // as the large preview; a named icon renders as the small identity glyph.
17 + readonly property string photoCandidate: String(modelData.image || "")
18 + readonly property bool imageIsPhoto: photoCandidate.indexOf("image://icon//") === 0
19 + || /\.(png|jpe?g|gif|webp|bmp)(\?|#|$)/i.test(photoCandidate)
20 + readonly property string iconSource: modelData.appIcon || (imageIsPhoto ? "" : photoCandidate)
21 + // image://icon//abs/path -> file:///abs/path so plain Image keeps true aspect
22 + readonly property string photoSource: !imageIsPhoto ? "" : (photoCandidate.indexOf("image://icon//") === 0 ? "file://" + photoCandidate.substring(13) : photoCandidate)
13 24 // local text styling, mirrors PopoutHost NuguText variants
14 25 component CardText: Text {
15 26 required property QtObject theme
82 93 anchors.verticalCenter: card.compact ? parent.verticalCenter : undefined
83 94 width: card.compact ? 20 : 36
84 95 height: width
85 - source: card.modelData.appIcon || ""
96 + source: card.iconSource
86 97 visible: source.toString().length > 0
134 145 Image {
135 - source: card.modelData.image || ""
146 + source: card.photoSource
136 147 visible: !card.compact && status === Image.Ready
137 148 width: Math.min(parent.width, 220)
138 149 fillMode: Image.PreserveAspectFit

quickshell/nuguland/PopoutHost.qml

Modified
1303 + // History can outgrow the popup; the header stays fixed and everything
1304 + // below scrolls. The Loader hosting this Column forces a concrete
1305 + // root.height, so the viewport can bound on it.
1307 + id: scrollArea
1304 1308 width: parent.width
1305 - height: 220
1306 - visible: root.groups.length === 0
1307 - Column {
1308 - anchors.centerIn: parent
1309 - spacing: 8
1310 - NuguText { anchors.horizontalCenter: parent.horizontalCenter; theme: root.theme; variant: "title"; text: "No notifications" }
1311 - NuguText { anchors.horizontalCenter: parent.horizontalCenter; theme: root.theme; variant: "meta"; text: "You're all caught up" }
1309 + height: Math.max(0, root.height - 28 - root.spacing)
1315 - Repeater {
1316 - model: root.groups
1317 - delegate: Column {
1318 - id: groupDelegate
1319 - required property var modelData
1320 - width: root.width
1321 - spacing: 6
1311 + Flickable {
1312 + id: scroll
1313 + anchors.fill: parent
1314 + contentHeight: scrollColumn.height
1315 + clip: true
1316 + interactive: contentHeight > height
1317 + boundsBehavior: Flickable.StopAtBounds
1318 + flickableDirection: Flickable.VerticalFlick
1320 + Column {
1321 + id: scrollColumn
1322 + width: scroll.width
1323 + spacing: 8
1325 + Item {
1326 + width: parent.width
1327 + height: 220
1328 + visible: root.groups.length === 0
1329 + Column {
1330 + anchors.centerIn: parent
1331 + spacing: 8
1332 + NuguText { anchors.horizontalCenter: parent.horizontalCenter; theme: root.theme; variant: "title"; text: "No notifications" }
1333 + NuguText { anchors.horizontalCenter: parent.horizontalCenter; theme: root.theme; variant: "meta"; text: "You're all caught up" }
1337 + Repeater {
1338 + model: root.groups
1339 + delegate: Column {
1340 + id: groupDelegate
1341 + required property var modelData
1342 + width: root.width
1343 + spacing: 6
1324 1346 width: parent.width
1389 + // slim scroll indicator, overlaid (outside the Flickable so it
1390 + // doesn't scroll with content); shown only when content overflows.
1391 + Rectangle {
1392 + anchors.right: parent.right
1393 + width: 3
1394 + radius: 2
1395 + visible: scroll.contentHeight > scroll.height + 1
1396 + color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.5) : "transparent"
1397 + height: Math.max(24, scrollArea.height * scrollArea.height / Math.max(1, scroll.contentHeight))
1398 + y: scroll.contentY * scrollArea.height / Math.max(1, scroll.contentHeight)

quickshell/nuguland/shell.qml

Modified
321 321 repeat: false
322 322 onTriggered: notifications.dismissToast(String(toastWrap.modelData.id))
324 + // auto-dismiss countdown: a thin bar drains across the
325 + // bottom edge over the toast's lifetime (sticky/critical
326 + // have timeoutMs 0 -> hidden; lowPowerMode -> static).
327 + Rectangle {
328 + visible: (toastWrap.modelData.timeoutMs || 0) > 0
329 + anchors.left: toastCard.left
330 + anchors.bottom: toastCard.bottom
331 + anchors.leftMargin: 12
332 + anchors.bottomMargin: 4
333 + height: 2
334 + radius: 1
335 + color: nuguTheme ? nuguTheme.withAlpha(nuguTheme.ui.accent, 0.55) : "transparent"
336 + width: toastCard.width - 24
337 + NumberAnimation on width {
338 + running: (toastWrap.modelData.timeoutMs || 0) > 0 && !(nuguTheme && nuguTheme.lowPowerMode)
339 + from: toastCard.width - 24
340 + to: 0
341 + duration: Math.max(1, toastWrap.modelData.timeoutMs || 0)