Skip to content

Resolve and persist notification icon hints and desktop identity - #12741

Closed
davidboulay wants to merge 3 commits into
omacom:quattrofrom
davidboulay:notification-icon-fallback
Closed

davidboulay wants to merge 3 commits into
omacom:quattrofrom
davidboulay:notification-icon-fallback

Conversation

@davidboulay

@davidboulay davidboulay commented Sep 21, 2026 •

Copy link
Copy Markdown

Notifications with an empty app_icon can lose their icon when they move into history. GTK/Ghostty notifications can also leave app_name empty: a captured notification carried desktop-entry=org.omarchy.agent and image-path=com.mitchellh.ghostty, but the persisted entry had an empty app, appIcon, and image.

Resolve the missing icon while taking the notification snapshot, so the existing image persistence pipeline can retain it:

  • Preserve an explicit app icon; otherwise use image-path (or legacy image_path), then the installed desktop entry's icon, then an app-name lookup.
  • Use desktop-entry as the app identity when app_name is empty.
  • Apply the same resolution to replacements and DND-silenced entries, and watch desktop-entry changes.
  • Retain the card's desktop-entry lookup for older history entries that still have a usable app name.

Per-notification image data keeps its existing rendering priority. File-backed fallback icons use the existing validated copy pipeline; themed icon names remain durable names. There are no Ghostty-specific conditions or window-focus changes in this PR.

Before / after

The same synthetic notification, replayed from disk after its original live image was gone:

Before After
Saved notification without its icon Saved notification retaining its icon

Persisted metadata changed from {"app":"","appIcon":"","image":""} to {"app":"org.example.Terminal","appIcon":"com.mitchellh.ghostty","image":""}. The synthetic sender deliberately uses an unknown desktop identity to exercise the image-path fallback independently of desktop lookup.

Validation

  • bash test/shell.d/notifications-test.sh: 158 assertions pass, including precedence, empty identities, desktop-entry hints/properties, legacy image paths, replacement snapshots, file-copy planning, and persistence/restore.
  • Live verification on Omarchy 4.0.4: inspected fresh and replayed notifications and confirmed the persisted JSON. The fix is also retained in a user-owned local notification plugin.
  • git diff --check: passes.
  • ./test/all: CLI passes; shell completes with 9 of 248 test files failing outside notifications. Seven fail identically on the unchanged PR head: config, factory-reset-accounts, launch-about, omarchy-kernel-migration, snapper, unowned-system-paths, and update-pacman. network-qr also exits 1 after the same two passing cases on both branches. locate fails on suite-generated bin/__pycache__ bytes; it passes on a clean baseline and reproduces the same decoding error when that generated cache is present. No notification-suite failures.

Related work

This extends the existing icon-fallback PR rather than opening a duplicate. #9985 fixes rendering of raw image-path values in the card; this change addresses snapshot metadata and persistence. #12567 identifies browser web-app icons from URLs, which is a separate source of icon identity. Senders supplying neither a usable image/icon nor a matching desktop identity can still remain iconless.

app_icon is optional in the notification spec and plenty of senders leave
it empty, so their toasts draw a blank icon slot. libnotify 0.8 made this
common: it no longer passes `notify-send -i` through as app_icon, moving
it to a desktop-entry hint the service does not read.

Those notifications still carry app_name, and that name is nearly always
the Name= of an installed desktop entry, which knows the app's icon. Look
it up by display name, desktop id or startup class before giving up.

No themed lookup on the name itself when that misses: an unconstrained
theme lookup resolves an app called "Mail" or "Zoom" to a stock action
icon, and a confidently wrong face is worse than none.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

No production defect confirmed in the scoped review of 201740a0da35.

Verified: the helper matches desktop entries by name, id or startup class, including case folding and the spaced-name retry. The notification suite passes all 143 assertions. Source inspection preserves this priority:

notification image
  otherwise: resolvable sender app_icon
  otherwise: matching desktop entry's icon  [new]
  no match: existing blank/glyph behavior

Optional test improvement: removing either startup-class matching or the hyphenated retry still leaves all 143 assertions passing. The Chrome fixture already matches its display name, and no assertion needs startupClass. Give the Chrome entry a different display name and add a class-only match, so those two regressions become detectable. These are test-coverage gaps, not failures of the current helper.

Documentation correction: consider removing or correcting the new libnotify sentence in NotificationLogic.js: upstream release notes describe an image-hint change in 0.8.4, reverted to app_icon in 0.8.5/0.8.6, not a move to desktop-entry.


Review information

Test scope: isolated JavaScript tests with synthetic desktop entries and diagnostic mutations; QML precedence and API checked by source/type metadata. No live notification, visual rendering or theme-resolution verification. Empty or unmatched app names remain outside the new fallback.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: GPT 6 Astra Medium initial inspection and synthesis, independent Opus 5.5 High and GPT 6 Sol Xhigh technical assessments, followed by verification against targeted test and source evidence.

The comment said libnotify 0.8 moved `notify-send -i` to a desktop-entry
hint. It did not: from 0.8.8 the icon goes out as the image-path hint,
and app_icon is filled from it only for servers speaking a spec older
than 1.1, which quickshell (1.2) is not. Captured off the session bus on
libnotify 0.8.8: app_icon "", hints image-path/urgency/sender-pid, no
desktop-entry.

The fixtures let two match paths go untested: "Google Chrome" matched
its display name before the hyphenated retry was ever tried, and no
assertion needed startupClass. Chrome's display name now differs from
the sender's app_name so only the hyphenated id reaches it, and a Signal
entry is reachable through its class alone. Removing either path in the
helper now fails its own assertion.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@davidboulay

Copy link
Copy Markdown
Author

Thanks, both taken in 3e7f900.

libnotify sentence: you're right that it was wrong, and the real story is a step further on than the 0.8.5 revert. From 0.8.8, notify-send -i goes out as the image-path hint, and libnotify copies it into app_icon only for servers whose spec version is below 1.1 (_notify_check_spec_version (1, 1) in notification.c); quickshell advertises 1.2. Captured off the session bus here on libnotify 0.8.8:

app_icon : ""
hints    : image-path, urgency, sender-pid

No desktop-entry hint at all, so the old wording was wrong about the mechanism too. The comment now says exactly that, and the PR description is corrected to match. The first commit's message still carries the old sentence since I added a commit rather than rewriting the branch; happy to squash if that's preferred.

Fixtures: Chrome's display name is now Chrome while the sender says Google Chrome, so only the hyphenated id reaches it, and a Signal Messenger entry is reachable only through startupClass: 'Signal'. I ran both mutations you described against the new fixtures: dropping startupClass from the key list fails the class assertion, dropping the hyphenated compare fails the Chrome one. 144/144.

@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Follow-up to the earlier review and the author's reply, checked at 3e7f900c.

Verified: both earlier notes are resolved. The new commit changes only a code comment and the tests, and no regression was found in the tested scope.

Verified, test coverage (resolved): each of the two match paths the earlier note named now fails its own assertion when removed. The notification suite passes 144/144 at 3e7f900c.

Diagnostic mutation of appIconFor Old fixtures (201740a0) New fixtures (3e7f900c)
drop startupClass from the keys 143/143 pass fails "startup class alone"
drop the hyphenated compare 143/143 pass fails "hyphenated id alone"

Verified, libnotify comment (resolved): the rewritten comment and PR description match the libnotify 0.8.8 source. notify-send -i is sent as the image-path hint, and app_icon is filled from it only when _notify_check_spec_version (1, 1) fails. quickshell's GetServerInformation reports spec 1.2. Correction to the earlier note: its version history stopped at the 0.8.5/0.8.6 revert. 0.8.8 moved -i back to the image hint and added -n, so the author's account is the more complete one. The earlier point that the desktop-entry wording was wrong still stands.

Verified, unchanged behavior: the appIconFor code and NotificationCard.qml are identical to 201740a0. Name, id and startup-class matching, case folding, the spaced-name retry and the icon precedence reported earlier are unaffected.

Squash offer: the first commit message still carries the old desktop-entry sentence. Whether to squash is the maintainers' choice.


Review information

Test scope: the notification test suite ran at both heads in an isolated sandbox, with synthetic desktop entries and labelled diagnostic mutations. libnotify 0.8.8 and quickshell notification-server source were read directly. The author's session-bus capture was not reproduced. The full ./test/shell runner, live notifications, QML runtime and visual rendering were not tested.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments of this follow-up, and an Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@davidboulay davidboulay changed the title Fall back to the desktop entry icon when a notification sends none Resolve and persist notification icon hints and desktop identity Sep 25, 2026
@davidboulay

Copy link
Copy Markdown
Author

Updated in eb27474: the fallback now resolves icon metadata when the notification is received, so the resolved icon survives persistence instead of only appearing on the live card.

This covers empty app names using desktop-entry, and empty app icons using image-path / legacy image_path, followed by desktop-entry and app-name lookup. Replacement notifications use the same resolution. Explicit app icons and per-notification image priority are preserved; there are no Ghostty-specific conditions or window-focus changes.

Validation: all 158 notification assertions pass. I also verified fresh notifications and disk-backed history replay in the running shell; before/after captures are now in the description. The full suite completed with nine unrelated failing test files, with baseline reproduction details documented there.

I checked related PRs before extending this one: #9985 addresses raw image-path rendering, while this update addresses metadata resolution and persistence; #12567 handles browser web-app identity. The title and description now describe the complete change.

@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Follow-up to the earlier follow-up and the author's update, checked at eb274743.

Verified: the new commit resolves app and appIcon when the notification arrives, so the icon now survives persistence and replay. The notification suite passes 158/158 (144 at 3e7f900c). Three cases that had no icon after restore at 3e7f900c keep it at eb274743 (JavaScript probes modelled on Quickshell v0.3.1 source):

Sender 3e7f900c, restored eb274743, restored
notify-send -i <themed name> no icon themed name kept
notify-send -i /abs/path.png no icon persisted as a copy of the file
desktop-entry=org.omarchy.agent, image-path=com.mitchellh.ghostty, empty app_name no icon, app empty themed name kept, app = org.omarchy.agent

Senders that set app_icon or per-notification image data keep their priority.

Earlier notes at this head:

  • Test coverage (still resolved): the appIconFor fixtures are unchanged, and removing the startup-class, hyphenated, name or id match path, or case folding, each still fails an assertion.
  • libnotify comment (resolved): eb274743 removed the whole explanatory comment above appIconFor. The new four-line comment makes no libnotify claim.
  • The earlier test-scope note that empty app names fall outside the fallback no longer applies to senders with a desktop-entry hint: app now falls back to it. Senders with no hint, image or matching entry stay iconless.

Clicking a replayed toast now focuses a window by desktop-entry id

The description says there are no window-focus changes, but the new app fallback reaches click-to-focus. Restored and replayed rows never run a live "default" action, so a click falls back to focusApp(entry), which returns early on an empty app and otherwise runs omarchy-hyprland-focus-app <app> (Service.qml:374-410). That helper takes the first window whose class matches the value as a case-insensitive regex.

replayed agent toast, click
  3e7f900c: app = ""                  -> focusApp returns, no window focused
  eb274743: app = "org.omarchy.agent" -> first window with that class is focused

bin/omarchy-agent:144 opens every agent window with --app-id=org.omarchy.agent. A sandboxed run of the unchanged helper with a mocked hyprctl listing two agent windows focused the first one. Live Ghostty toasts are not affected, because Ghostty registers a default action.

Impact: with more than one agent open, clicking a replayed agent toast can focus a different agent than the one that notified. Other desktop-entry-only senders now get click-to-focus by id where the click previously focused nothing.

Suggested change: either state this as intended in the description, or keep the desktop-entry id in its own snapshot field so focusApp keeps its previous input (#12884 adds a separate desktopEntry field).

Optional test improvement: each of these edits still passes all 158 assertions:

  • dropping desktopEntries from Service.qml's snapshotOf call, which turns off the desktop-entry and app-name icon lookups at receive time;
  • dropping it from either replacementSnapshot call;
  • removing desktopEntryChanged;
  • moving the desktop-entry and app-name lookups ahead of image-path.

The test file already pins Service.qml wiring with regex assertions, so the calls can be pinned the same way. A fixture with both an image-path and a resolvable desktop entry would pin the order the description states.

Failed image copy on restore: a file-backed image-path is now stored in appIcon, and the persisted entry points at its copy whether or not the copy succeeds. If the copy fails (source gone, over the 5 MB limit or not a regular file), the restored card points at a missing copy and hides the desktop-entry fallback that 3e7f900c showed for a named sender. The merge base showed no icon in that case either.

Design note: Quickshell v0.3.1 already fills appIcon from a desktop-entry hint that matches an installed entry id, and already maps a non-file: image-path into image as image://icon/.... The icons were lost because persistablePopup drops image:// values. Persisting the name or path behind them would be an alternative that keeps per-notification image content out of appIcon. The current approach does fix the targeted senders.

Related PRs: #9985 and #12567 serve different purposes, but each conflicts with this PR on the same smallIconSource binding in NotificationCard.qml, and #12567 sets its own order (image, web-app icon, app icon). #9660, #12111 and #13312 each use the new third parameter of snapshotOf for something else.


Review information

Test scope: the notification suite ran at the merge base, 3e7f900c and eb274743 in an isolated sandbox, with labelled diagnostic mutations and JavaScript probes modelled on Quickshell v0.3.1 source. omarchy-hyprland-focus-app ran against a mocked hyprctl. Quickshell, GLib and Ghostty source were read directly. Merge conflicts were checked with git merge-tree against open PR heads. No live notifications, QML runtime or visual rendering, and the author's ./test/all result was not reproduced.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@staruxian

Copy link
Copy Markdown

Tested this against the exact Notify call captured in #13184 (Claude Code running inside Ghostty: app_icon="", app_name="Claude Code", hints desktop-entry=com.mitchellh.ghostty, image-path=com.mitchellh.ghostty).

Using snapshotOf() from NotificationLogic.js with Ghostty's desktop entry (Icon=com.mitchellh.ghostty):

quattro this PR (eb274743)
both hints appIcon: "" appIcon: "com.mitchellh.ghostty"
desktop-entry hint only "" "com.mitchellh.ghostty"
desktopEntry property only "" "com.mitchellh.ghostty"

test/shell.d/notifications-test.sh passes (158 ok, 0 failed). This fixes #13184.

@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 at eb274743, and the fix does what it says. Run on a disposable Omarchy worker with the shell loaded from this branch.

Reproduction. I sent notifications over D-Bus with an empty app_name and app_icon and read the history files the shell wrote. On the base (ee8ebf61), a desktop-entry hint left app empty, and an image-path hint (a themed name, a bare path, or a file:// URI) left appIcon empty. On this head, app takes the desktop-entry id. appIcon takes the themed name, or a copy under notifications/images/ for a file. A replaces_id update that adds a desktop-entry resolves the same way. A sender that gives no hints stays iconless, as the description says.

Tests. ./test/cli passes. test/shell.d/notifications-test.sh passes 158/158 on the head, and 165/165 with today's quattro merged in, which includes the new de-duplication of identical toasts keyed on app. The merge is clean. The one test/cli failure on the merged tree, vscode generated theme references current theme file, fails the same way on quattro alone.

Two side effects, neither blocking:

  • app now carries the desktop-entry id, and clicking a toast passes it to omarchy-hyprland-focus-app. Before, a toast with an empty app_name focused nothing. Now one from an agent terminal focuses the first org.omarchy.agent window, which may not be the one that sent it. For most GTK apps the desktop id is also the window class, so there it is an improvement. The description says there are no window-focus changes, which isn't quite the case.
  • When image-path is a file:// URI, Quickshell already puts it in image, and it now also goes into appIcon, so it gets copied to disk twice. Nothing you can see changes, because the card draws image first.

Who checked it. This review is Claude Opus 5.5's alone. The second opinion, Codex Medium, answers but did not run, because today's review budget was spent. Until it reviews this head, this pull request is labelled verified, not ready.

Waiting on a second opinion, then the maintainer. Nothing is needed from you.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 20, 2026
@ryanrhughes

Copy link
Copy Markdown
Collaborator

Thanks @davidboulay! The new engine falls back from app_icon to the image-path name and then the desktop-entry hint, and keeps that name with the stored row, so history and restored cards keep the icon. 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

Development

Successfully merging this pull request may close these issues.

5 participants