Skip to content

Resolve notification image-path through iconSource - #9985

Closed
crwirth wants to merge 3 commits into
omacom:quattrofrom
crwirth:fix/9920-notification-image-path
Closed

crwirth wants to merge 3 commits into
omacom:quattrofrom
crwirth:fix/9920-notification-image-path

Conversation

@crwirth

@crwirth crwirth commented Sep 3, 2026 •

Copy link
Copy Markdown

Summary

NotificationCard preferred image over appIcon but only ran appIcon through iconSource(). Spec image-path may be a themed icon name (notify-send -i); a bare name was treated as a relative URL and Qt painted the magenta missing-texture placeholder.

Fix

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

Missing themed names become "" and the existing slot visibility guard hides the icon.

Fixes #9920

Test plan

  • Reproduced bare image ternary on quattro
  • bash test/shell.d/notifications-test.sh — prior cases plus image-path routed through iconSource

Fixes #7558

notify-send -i puts a themed icon name in the image-path hint. The card
fed that string straight to Image.source, so missing names painted Qt's
placeholder. Route image through the same iconSource check as appIcon.

Fixes #9920

Signed-off-by: fresh3nough <anonwurcod@proton.me>
@SorenHJohansen

Copy link
Copy Markdown
Contributor

This fixes the bare-name path but still leaves the Chromium/Vivaldi trigger showing the magenta placeholder. Verified on Omarchy 4.0.0.alpha + Quickshell 0.3.1.

When Vivaldi delivers a Proton Mail notification, it sends an image-path hint with a themed icon name (e.g. mail-message-*). Quickshell's NotificationServer.updateProperties maps any non-file: image-path value through IconImageProvider::requestString(name, ""), so the card's image is image://icon/<name>, not a bare name and not image://icon//<abs-path>. With only this PR applied, iconSource() hits its image:// branch and returns the URL unchanged, and the provider paints the 2x2 #d900d8/black checkerboard (status Ready, so the !== Image.Error guard on line 119 never fires).

Repro:

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

The existing guard can be made to work by resolve-checking image://icon/ names in iconSource, exactly like appIcon themed names are checked on the last line:

function iconSource(icon) {
  var value = String(icon || "")
  if (value.length === 0) return ""
  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 missing icons, so hasSmallIcon goes false and the slot is hidden. This closes issue #7558.

@SorenHJohansen

Copy link
Copy Markdown
Contributor

Note: this also covers #9920 (the issue this PR targets) — same root defect, a themed icon name arriving via the image-path hint instead of app_icon. Both produce image://icon/<name> in the card on Quickshell 0.3.x (the shell maps non-file: image-path values through IconImageProvider::requestString), so both need the image://icon/ name check in iconSource above. #9920's assumption that routing through iconSource alone is sufficient doesn't hold on this Quickshell: the URL form passes the image:// branch unchanged. The diff in my previous comment closes #9920 and #7558 together.

omarchybot and others added 2 commits October 2, 2026 03:50
Quickshell 0.3 turns an image-path hint that is not a file: URI into image://icon/<name> before the card sees it, so routing image through iconSource alone passed it straight to Image.source and a missing name still painted the placeholder (#9920). Resolve those names with Quickshell.iconPath's check, leaving absolute paths and provider queries as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quickshell passes any image-path starting with file: through untouched, and the card used to hand it straight to Image.source. Now that image goes through iconSource, file:/tmp/avatar.png fell through to the theme lookup and was hidden, so treat every file:/ URI as a URL to load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed, reproduced on an Omarchy worker (Quickshell 0.3.1), and fixed on this branch with two commits on top of yours.

Routing image through iconSource() was not enough on its own. Quickshell 0.3.1 never hands the card a bare name: for any image-path that does not start with file: it builds image://icon/<name> (src/services/notifications/notification.cpp, IconImageProvider::requestString), and iconSource() returned every image:// URL unchanged. With notify-send --hint=string:image-path:definitely-not-an-installed-icon, the toast drew the same 800 magenta placeholder pixels on quattro and on f379e2a, as @SorenHJohansen described above. The tests in f379e2a pass either way, because they match the source text rather than run it.

What changed:

  • ddb2b97 makes iconSource() check image://icon/<name> through Quickshell.iconPath(name, true), as it already does for a bare app_icon, so a missing name becomes "" and the slot hides. Absolute paths (image://icon//…), provider queries (?path=, ?fallback=) and image-data URLs are passed through as before. The new test runs iconSource itself and fails without this change.
  • f97ac50 keeps a single-slash file:/path.png image-path loading. Quickshell passes those through untouched and the card used to load them directly, but once image went through iconSource() they fell to the theme lookup and disappeared. Codex found this one.

On the worker at f97ac50: the missing name draws no placeholder and the slot is hidden, a file:/ image fills the 40×40 slot exactly as it does on quattro. An installed theme name (mail-unread) was checked at ddb2b97 and still shows its icon; f97ac50 touches only the file: branch. test/shell.d/notifications-test.sh (145 passed) and ./test/cli pass. Codex Medium reviewed it in two rounds. The first round found the file:/ regression above. The second round, on f97ac50, found nothing. That agreement is not guaranteed independent, since the reviewer can read this session's notes.

This also fixes #7558, which has the same steps and cause, so it is now linked. #6507 rewrites the same smallIconSource line and iconSource() to check that files exist. It does not fix this case, because it still passes image://icon/<name> through, but the two will conflict, so whichever lands second needs a rebase.

Waiting on the maintainer: CI has not run on this fork's pull request yet, and the order with #6507 is theirs to choose.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how notification icons are resolved and displayed.

The PR appears safe to merge; no actionable regression was established.

Summary

The PR routes notification images through iconSource and checks plain image://icon/<name> values against the icon theme so missing names do not paint a placeholder. It adds assertions for the routing and several URI forms.

Reviews (1) · Last reviewed commit: "Keep loading a single-slash file: image-..."

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Thanks @fresh3nough! The new engine pulls a bare image-path theme name back out and resolves it like an app icon, so no more magenta checkerboard. Closing since the new notification engine (#15932) handles it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

4 participants