repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

notifications: top-screen toast overlay with per-card auto-dismiss and sticky critical

7110ea6e8f68976457c55a47bf1f18ebd8cdf3a7

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Adds a Variants/PanelWindow on WlrLayer.Overlay that renders a vertical
stack of compact NotificationCards for activeToastRows(), each with a
per-card auto-dismiss Timer. Also fixes toastTimeoutMs to pass expireTimeout
directly (Quickshell already delivers the value in milliseconds, so the
previous * 1000 multiplier produced ~50-minute timers instead of 3-second
ones). Critical urgency toasts remain sticky (timeoutMs 0, Timer not running).

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

Changed files (2)

quickshell/nuguland/Notifications.qml

Modified
134 134 if (row.urgency === "critical" || Number(row.expireTimeout) === 0)
135 135 return 0;
136 136 const et = Number(row.expireTimeout);
137 - return et > 0 ? Math.round(et * 1000) : defaultToastTimeoutMs;
137 + return et > 0 ? et : defaultToastTimeoutMs;
140 140 function mergeRow(list, row) {

quickshell/nuguland/shell.qml

Modified
265 + Variants {
266 + model: Quickshell.screens
268 + delegate: Component {
269 + PanelWindow {
270 + required property var modelData
272 + readonly property var toasts: notifications.activeToastRows()
274 + objectName: "notificationToastSurface"
275 + screen: modelData
276 + visible: toasts.length > 0
277 + implicitWidth: 380
278 + implicitHeight: Math.max(1, toastColumn.implicitHeight + 16)
279 + color: "transparent"
280 + exclusionMode: ExclusionMode.Ignore
281 + WlrLayershell.layer: WlrLayer.Overlay
282 + WlrLayershell.namespace: "nuguland-toast"
283 + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
285 + anchors { top: true; right: true }
286 + margins { top: 48; right: 16 }
288 + Column {
289 + id: toastColumn
290 + anchors.top: parent.top
291 + anchors.right: parent.right
292 + anchors.margins: 8
293 + width: parent.width - 16
294 + spacing: 8
296 + Repeater {
297 + model: toasts
298 + // Wrap in a plain Item: Qt6 does NOT inject an array
299 + // model's modelData into a required property on an
300 + // external-component (NotificationCard) delegate root —
301 + // the wrapper takes the injection and passes it down
302 + // explicitly. (Same fix used for the popup in Task 3.)
303 + delegate: Item {
304 + id: toastWrap
305 + required property var modelData
306 + width: toastColumn.width
307 + implicitHeight: toastCard.implicitHeight
308 + height: implicitHeight
309 + NotificationCard {
310 + id: toastCard
311 + width: parent.width
312 + theme: nuguTheme
313 + modelData: toastWrap.modelData
314 + compact: true
315 + onDismiss: (id) => notifications.dismissToast(id)
316 + onInvokeAction: (id, actionId) => notifications.runAction(id, actionId)
318 + Timer {
319 + running: (toastWrap.modelData.timeoutMs || 0) > 0
320 + interval: Math.max(1, toastWrap.modelData.timeoutMs || 0)
321 + repeat: false
322 + onTriggered: notifications.dismissToast(String(toastWrap.modelData.id))
328 + mask: Region {}
265 333 Variants {
266 334 model: Quickshell.screens