From 2c38de7c603489aa2c9439114c1358a8572e5c39 Mon Sep 17 00:00:00 2001 From: Hannes Date: Mon, 31 Aug 2026 16:34:18 +0200 Subject: [PATCH] feat: refactor notification body to use a more concise conditional expression for handling app icons, images, and desktop entry icons --- modules/notification/NotificationBody.qml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/notification/NotificationBody.qml b/modules/notification/NotificationBody.qml index 78dd8ab..9491515 100644 --- a/modules/notification/NotificationBody.qml +++ b/modules/notification/NotificationBody.qml @@ -131,12 +131,16 @@ Rectangle { height: iconImage.width anchors.horizontalCenter: parent.horizontalCenter - source: ( - notification.appIcon ? Quickshell.iconPath(notification.appIcon) : - notification.image ? notification.image : - Quickshell.iconPath(DesktopEntries.byId(notification.desktopEntry).icon) ? Quickshell.iconPath(DesktopEntries.byId(notification.desktopEntry).icon) : - Quickshell.iconPath("notifications") - ) + source: { + if (notification.appIcon) return Quickshell.iconPath(notification.appIcon) + if (notification.image) return notification.image + const entry = notification.desktopEntry ? DesktopEntries.byId(notification.desktopEntry) : null + if (entry && entry.icon) { + const p = Quickshell.iconPath(entry.icon) + if (p && p !== "") return p + } + return Quickshell.iconPath("notifications") + } fillMode: Image.PreserveAspectFit asynchronous: true