diff --git a/settings/quickshell.nix b/settings/quickshell.nix index cb30da4..7c98ea1 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -513,7 +513,9 @@ in elide: Text.ElideRight maximumLineCount: _nc.bodyLines wrapMode: Text.Wrap - visible: text !== "" + // ponytail: hyprshot's body is a noisy file path; the + // "Screenshot saved" summary + the preview say enough. + visible: text !== "" && !(_nc.notif && _nc.notif.appName === "Hyprshot") } Row { spacing: 4 @@ -966,6 +968,17 @@ in activeDropdown.animateClose(); } } + + // Preview image for a notification: its image hint, else a + // file-path appIcon (e.g. hyprshot's saved shot). "" = none. + function notifPreviewSource(notif) { + if (!notif) return ""; + if (notif.image && notif.image !== "") return notif.image; + let a = notif.appIcon || ""; + if (a.startsWith("file://")) return a; + if (a.startsWith("/")) return "file://" + a; + return ""; + } function toggleDropdown(dd, setupFn) { if (dd.visible && !dd.closing) { dd.animateClose(); @@ -2625,16 +2638,7 @@ in Rectangle { id: notifItem required property var modelData - // Prefer the notification's image; fall back to a - // file-path appIcon (e.g. hyprshot's saved shot). - readonly property string previewSource: { - let m = notifItem.modelData; - if (m.image && m.image !== "") return m.image; - let a = m.appIcon || ""; - if (a.startsWith("file://")) return a; - if (a.startsWith("/")) return "file://" + a; - return ""; - } + readonly property string previewSource: bar.notifPreviewSource(notifItem.modelData) width: parent.width height: Math.max(notifPreview.visible ? 48 : 0, ncBody.height) + 16 radius: Theme.radiusSmall @@ -2785,14 +2789,33 @@ in anchors.left: parent.left anchors.right: parent.right anchors.margins: 6 - height: toastCol.height + 16 + height: Math.max(toastPreview.visible ? 48 : 0, toastCol.height) + 16 radius: Theme.radiusSmall color: Theme.base02 + property string previewSource: bar.notifPreviewSource(toastItem.currentNotif) + + // Image preview (screenshot thumb, album art…) + ClippingRectangle { + id: toastPreview + visible: toastCard.previewSource !== "" + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: 8 + width: 48; height: 48 + radius: Theme.radiusTiny + color: Theme.base01 + Image { + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + source: toastCard.previewSource + } + } + NotifContent { id: toastCol notif: toastItem.currentNotif - anchors.left: parent.left + anchors.left: toastPreview.visible ? toastPreview.right : parent.left anchors.right: toastDismiss.left anchors.top: parent.top anchors.margins: 8