repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

notifications: fix card never rendering (delegate modelData + column width)

a13d083ff21a004336d6811160e895587f6bd143

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Two bugs left the rebuilt popup cards blank:

1. The inner Repeater used `delegate: NotificationCard { ... }` with the
   card's `required property var modelData` uninitialized. Qt6 does not
   inject an array model's modelData into a required property on an
   external-component delegate root, so "Cannot create delegate /
   Required property modelData was not initialized" aborted all child
   instantiation (only the root Rectangle painted). Wrap the card in a
   plain Item that takes the injection and passes it down explicitly.

2. The card's content Column sized off `parent.width` where the parent is
   a Row (content-derived width) -> binding loop collapsing it to 0. Size
   off the card's own externally-set width instead.

Verified via screenshot: bold summary, wrapped body, critical red accent
bar, app name, action button, and time all render.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Changed files (2)

quickshell/nuguland/NotificationCard.qml

Modified
88 88 Column {
89 - width: parent.width - (card.compact ? 30 : 46) - closeCol.width
89 + // size off the card's own (externally-set) width, NOT parent.width:
90 + // cardBody is a Row whose width derives from content, so reading it
91 + // here collapses the column to 0 (a binding loop). 22 = left+right margins.
92 + // size off the card's own (externally-set) width, NOT parent.width:
93 + // cardBody is a Row whose width derives from content, so reading it
94 + // here collapses the column to 0 (a binding loop). 22 = left+right margins.
95 + width: card.width - 22 - (card.compact ? 30 : 46) - closeCol.width
90 96 spacing: card.compact ? 0 : 3
92 98 Row {

quickshell/nuguland/PopoutHost.qml

Modified
1339 1339 Repeater {
1340 1340 model: groupDelegate.modelData.visibleNotifications || []
1341 - delegate: NotificationCard {
1341 + delegate: Item {
1342 + id: cardWrap
1343 + required property var modelData
1342 1344 width: root.width
1343 - theme: root.theme
1344 - onDismiss: (id) => root.runAction(id, "close")
1345 - onInvokeAction: (id, actionId) => root.runAction(id, actionId)
1345 + implicitHeight: cardInner.implicitHeight
1346 + height: implicitHeight
1347 + NotificationCard {
1348 + id: cardInner
1349 + width: parent.width
1350 + theme: root.theme
1351 + modelData: cardWrap.modelData
1352 + onDismiss: (id) => root.runAction(id, "close")
1353 + onInvokeAction: (id, actionId) => root.runAction(id, actionId)