notifications: prefer the icon theme for path app_icons

fixes #2746
This commit is contained in:
bbedward committed 2026-08-27 11:28:18 -04:00
1 parent 78352fd1fc
commit f8cf761fa6
1 file changed
+20
@@ -792,6 +792,21 @@ Singleton {
return Paths.strip(image);
}
// Apps like kitty send app_icon as their bundled logo path; the themed icon wins when the basename resolves (#2746).
function notificationThemedAppIcon(appIcon) {
if (/^https?:\/\//.test(appIcon))
return "";
const path = appIcon.startsWith("file://") ? appIcon.substring(7) : appIcon;
if (!path.startsWith("/"))
return "";
const file = path.substring(path.lastIndexOf("/") + 1);
const dot = file.lastIndexOf(".");
const base = dot > 0 ? file.substring(0, dot) : file;
if (!base)
return "";
return Paths.themedIconPath(base) ? base : "";
}
function notificationImageSource(image, appIcon) {
image = image || "";
appIcon = appIcon || "";
@@ -801,6 +816,8 @@ Singleton {
return "";
if (!appIcon)
return "";
if (notificationThemedAppIcon(appIcon))
return "";
return /^(file|https?):\/\//.test(appIcon) || appIcon.includes("/") ? appIcon : "";
}
@@ -810,6 +827,9 @@ Singleton {
const fromImage = notificationIconFromImage(image);
if (notificationImageHasSpecialPrefix(image))
return fromImage;
const themed = notificationThemedAppIcon(appIcon);
if (themed)
return themed;
return appIcon || fromImage || "";
}