From b8fd52e00ff9fca69927f19a4caf04dab006d21a Mon Sep 17 00:00:00 2001 From: purian23 Date: Fri, 3 Jul 2026 13:38:21 -0400 Subject: [PATCH] fix(Notifications): update hasNotificationImage logic to support file paths - Fixes #2533 --- .../Modules/Notifications/Center/HistoryNotificationCard.qml | 5 +++-- quickshell/Modules/Notifications/Center/NotificationCard.qml | 4 ++-- quickshell/Modules/Notifications/Popup/NotificationPopup.qml | 4 ++-- quickshell/Services/NotificationService.qml | 5 +++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/quickshell/Modules/Notifications/Center/HistoryNotificationCard.qml b/quickshell/Modules/Notifications/Center/HistoryNotificationCard.qml index 0633c4669..379a9063f 100644 --- a/quickshell/Modules/Notifications/Center/HistoryNotificationCard.qml +++ b/quickshell/Modules/Notifications/Center/HistoryNotificationCard.qml @@ -123,7 +123,8 @@ Rectangle { const icon = iconFromImage; return icon.startsWith("material:") || icon.startsWith("svg:") || icon.startsWith("unicode:") || icon.startsWith("image:"); } - readonly property bool hasNotificationImage: rawImage !== "" && !rawImage.startsWith("image://icon/") + readonly property bool hasNotificationImage: rawImage !== "" && (!rawImage.startsWith("image://icon/") || iconFromImage.startsWith("/")) + readonly property string resolvedImage: iconFromImage.startsWith("/") ? ("file://" + iconFromImage) : rawImage width: iconSize height: iconSize @@ -132,7 +133,7 @@ Rectangle { imageSource: { if (hasNotificationImage) - return historyItem.image; + return resolvedImage; if (imageHasSpecialPrefix) return ""; const appIcon = historyItem.appIcon; diff --git a/quickshell/Modules/Notifications/Center/NotificationCard.qml b/quickshell/Modules/Notifications/Center/NotificationCard.qml index 1f3315bdb..7cb824c5c 100644 --- a/quickshell/Modules/Notifications/Center/NotificationCard.qml +++ b/quickshell/Modules/Notifications/Center/NotificationCard.qml @@ -263,7 +263,7 @@ Rectangle { const icon = iconFromImage; return icon.startsWith("material:") || icon.startsWith("svg:") || icon.startsWith("unicode:") || icon.startsWith("image:"); } - readonly property bool hasNotificationImage: rawImage !== "" && !rawImage.startsWith("image://icon/") + readonly property bool hasNotificationImage: rawImage !== "" && (!rawImage.startsWith("image://icon/") || iconFromImage.startsWith("/")) width: iconSize height: iconSize @@ -606,7 +606,7 @@ Rectangle { const icon = iconFromImage; return icon.startsWith("material:") || icon.startsWith("svg:") || icon.startsWith("unicode:") || icon.startsWith("image:"); } - readonly property bool hasNotificationImage: rawImage !== "" && !rawImage.startsWith("image://icon/") + readonly property bool hasNotificationImage: rawImage !== "" && (!rawImage.startsWith("image://icon/") || iconFromImage.startsWith("/")) width: expandedIconSize height: expandedIconSize diff --git a/quickshell/Modules/Notifications/Popup/NotificationPopup.qml b/quickshell/Modules/Notifications/Popup/NotificationPopup.qml index 814f8972d..f2212f09b 100644 --- a/quickshell/Modules/Notifications/Popup/NotificationPopup.qml +++ b/quickshell/Modules/Notifications/Popup/NotificationPopup.qml @@ -814,8 +814,8 @@ PanelWindow { const icon = iconFromImage; return icon.startsWith("material:") || icon.startsWith("svg:") || icon.startsWith("unicode:") || icon.startsWith("image:"); } - readonly property bool hasNotificationImage: rawImage !== "" && !rawImage.startsWith("image://icon/") - readonly property bool needsImagePersist: hasNotificationImage && rawImage.startsWith("image://qsimage/") && !notificationData.persistedImagePath + readonly property bool hasNotificationImage: rawImage !== "" && (!rawImage.startsWith("image://icon/") || iconFromImage.startsWith("/")) + readonly property bool needsImagePersist: hasNotificationImage && (rawImage.startsWith("image://qsimage/") || iconFromImage.startsWith("/")) && !notificationData.persistedImagePath width: popupIconSize height: popupIconSize diff --git a/quickshell/Services/NotificationService.qml b/quickshell/Services/NotificationService.qml index b26d03057..7ef3d4134 100644 --- a/quickshell/Services/NotificationService.qml +++ b/quickshell/Services/NotificationService.qml @@ -866,6 +866,11 @@ Singleton { readonly property string cleanImage: { if (!image) return ""; + if (image.startsWith("image://icon/")) { + const payload = image.substring(13); + if (payload.startsWith("/")) + return "file://" + payload; + } return Paths.strip(image); } property int urgencyOverride: notification?.urgency ?? NotificationUrgency.Normal