omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Notification icon slot renders a magenta placeholder instead of hiding when an icon fails to resolve

Open jpchabot opened this issue 3 months ago • 3 comments

System details

AMD Ryzen 7 7800X3D, NVIDIA RTX 4090 (nvidia 610.57.04), Omarchy 4.0.0-1, Hyprland 0.56.2, Quickshell 0.3.0 (quickshell-git, rev 28771c7c), qt6-base 6.11.1-1, kernel 7.1.8-arch1-3

What's wrong?

When a notification requests a themed icon that cannot be resolved, the icon slot renders a 2x2 magenta/black placeholder instead of being hidden.

Steps to reproduce

notify-send -i this-icon-does-not-exist-12345 "Test" "unresolvable icon name"

Expected: the icon slot is hidden, as the comment on NotificationCard.qml lines 117-118 intends. Actual: a magenta/black checkerboard.

Why the existing guard cannot fire

shell/plugins/notifications/components/NotificationCard.qml line 119:

visible: !root.collapseRedundantIcon && !root.compactGlyph && (root.hasSmallIcon || root.hasGlyph) && (root.hasGlyph || smallIconImage.status !== Image.Error)

The comment above it states the intent: "prevents rendering Qt's pink broken-image placeholder".

However, Quickshell's image://icon/ provider logs a warning but still returns a valid placeholder image with status === Image.Ready. It never returns Image.Error, so the condition can never be true. Measured with a standalone Quickshell probe on this system:

image://icon/this-icon-does-not-exist-12345   sourceSize=40   ->  status Ready, 40x40 placeholder
image://icon/this-icon-does-not-exist-12345   sourceSize=0    ->  status Ready, 2x2 placeholder

The shell log at the same moment:

Could not load icon "this-icon-does-not-exist-12345" at size QSize(2, 2) from request
Could not load icon "this-icon-does-not-exist-12345" at size QSize(128, 128) from request

A 2x2 placeholder scaled into the 40px slot is the four-quadrant checkerboard seen on screen.

Separately, line 39 routes the image-path hint straight to Image.source, bypassing iconSource() and the Quickshell.iconPath(value, true) check that it applies to appIcon on line 63:

readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon)

Suggested fix

Quickshell.iconPath(name, true) correctly returns "" for an unresolvable name. Validating through it before assigning Image.source -- including for the image-path hint on line 39 -- would let the existing hide-the-slot logic work, instead of depending on an Image.Error that never arrives.

How I encountered it (context, not the bug)

I first hit this with com.mitchellh.ghostty, whose icon is installed in ten sizes under /usr/share/icons/hicolor/. That turned out to be a stale icon cache rather than a missing icon: Ghostty was installed after my Quickshell process started, /usr/share/icons/hicolor/icon-theme.cache was regenerated afterward, and the long-running shell held a pre-install view of it. Icons already in the cache (vivaldi, folder, application-x-executable) resolved correctly throughout, and omarchy restart shell clears it. That part is not an Omarchy bug and is not what this issue reports.

It is only how I noticed the placeholder behaviour above, which reproduces on a freshly restarted shell with a clean cache using the notify-send command given earlier.

Related

#7203 reaches the same rendering defect from a different trigger -- an icon theme name (Yaru-gray) that is absent from disk. Fixing this guard would cover both.

jpchabot avatar Aug 19 '26 23:08 jpchabot

Confirming this on Omarchy 4.0.0.alpha (Arch package 4.0.4-1) with Quickshell 0.3.1 (Arch).

Reproduction (matches the mail-notification case)

A Proton Mail notification arriving through Vivaldi triggers it. Vivaldi (Chromium-family) sends the notification via the image-path hint with an icon name that isn't in the icon theme; Quickshell maps it to image://icon/<name> (server.cpp updateProperties: non-file: image-path values go through IconImageProvider::requestString), and the card on line 39 routes it straight to Image.source, bypassing the Quickshell.iconPath(name, true) check applied to appIcon on line 63.

Minimal repro:

notify-send --hint=string:image-path:this-icon-does-not-exist-12345 -u normal "Test" "body"

Pixel-verified on screen: an 840px block of #d900d8 + black checkerboard in the 40px icon slot. smallIconImage.status is Ready throughout — the !== Image.Error guard on line 119 never fires, exactly as measured in the issue.

Fix

Patch the card's iconSource to resolve-check image://icon/ names, and route the image role through it too:

-  readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon)
+  readonly property string smallIconSource: image.length > 0 ? iconSource(image) : iconSource(appIcon)
...
   function iconSource(icon) {
     var value = String(icon || "")
     if (value.length === 0) return ""
-    if (value.indexOf("file://") === 0 || value.indexOf("image://") === 0) return value
+    if (value.indexOf("file://") === 0) return value
+    if (value.indexOf("image://icon/") === 0) {
+      // Query forms (path/fallback) keep their provider handling.
+      if (value.indexOf("?") !== -1) return value
+      return Quickshell.iconPath(value.slice("image://icon/".length), true)
+    }
+    if (value.indexOf("image://") === 0) return value
     if (value.charAt(0) === "/") return Util.fileUrl(value)
     return Quickshell.iconPath(value, true)
   }

Quickshell.iconPath(name, true) returns "" for unresolvable names, so hasSmallIcon goes false and the slot is hidden — no dependence on an Image.Error that never arrives. This covers both the image-path route (line 39) and the appIcon themed-name route.

Happy to turn this into a PR if useful.

SorenHJohansen avatar Sep 28 '26 17:09 SorenHJohansen

Checked against quattro (b83d3df) and Quickshell's source; the mechanism is as described here. libnotify's notify-send -i sends the name as the image-path hint, Quickshell turns a non-file: image-path into image://icon/<name>, and NotificationCard.qml:40 passes a non-empty image straight to Image.source without the Quickshell.iconPath(name, true) check that appIcon gets. Quickshell's icon provider answers an unknown name with its black and #d900d8 checker pixmap at status Ready, so the Image.Error guard on line 120 cannot hide it. That guard still fires for a missing file: image; it is only the themed-name route that bypasses it.

#9985 is the open fix for this: it routes image through iconSource() and checks image://icon/<name> with Quickshell.iconPath(name, true), leaving image-data avatars, absolute paths and ?path=/?fallback= queries as they were. It already closes this issue and has been verified on a worker as its own item. #6507 and #12741 touch the same lines but neither hides an unresolvable themed name. #9920 and #10995 describe the same rendering defect, reported later.

Not reproduced here: nothing was run for this issue itself, since the fix is exercised on #9985. The diagnosis was checked independently by Codex Medium, which agreed with the mechanism and the fix, and added that a percent-encoded icon name would be checked undecoded by #9985, an edge case no sender has been seen to produce. Independence between the two reviews is not guaranteed.

Waiting on the maintainer to decide on #9985.

omarchybot avatar Oct 08 '26 11:10 omarchybot

Handled correctly by new notification engine (https://github.com/omacom/omarchy/pull/15932)

jpchabot avatar Oct 22 '26 11:10 jpchabot