fix(tray): resolve icons advertised with custom theme path#1490
Open
pedroboussiengui wants to merge 1 commit into
Open
fix(tray): resolve icons advertised with custom theme path#1490pedroboussiengui wants to merge 1 commit into
pedroboussiengui wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Tray icons from apps that ship their own icon theme (Dropbox, KeePassXC, and others) never render — only the missing-icon fallback shows up. The bar still receives the item (clicks and the menu work), but the pixmap is blank.
Root cause
Such apps expose their icon over StatusNotifierItem as:
For example, Dropbox sends:
The advertised
pathis the theme root (containinghicolor/<size>/<category>/...), not the leaf directory of the file. The previousIcons.getTrayIconsplit the URL and builtfile://<path>/<name>directly — no extension, wrong directory — soIconImagecould never load it.Fix
getTrayIconwithgetTrayIconCandidates(id, icon)which returns an ordered list of candidate URLs:iconSubsoverrides (unchanged behavior).pathroot, with.png/.svg.[hicolor|""]/<size>/<category>/<name>.<ext>across common sizes (16x16→scalable) and categories (status,apps,actions, …).TrayItemconsumes the list and walks to the next candidate onImage.Error, stopping at the first that loads.For icons without
?path=(most apps using the system theme, orimage://qspixmap/...fromIconPixmap), the candidate list is just[icon], so behavior is unchanged.Files
utils/Icons.qml: introducesgetTrayIconCandidates.modules/bar/components/TrayItem.qml: iterates candidates on load failure.Testing
…/images/hicolor/16x16/status/dropboxstatus-idle.png).image://icon/<name>(Arch-Update, etc.): unchanged.image://qspixmap/...from apps that embed pixmaps via D-Bus: unchanged.iconSubssubstitutions inbar.tray.iconSubs: still applied first.Notes
The freedesktop spec calls for a full theme lookup using
index.theme, but doing that in pure QML would mean parsing the theme file and walking directories. The candidate-list approach covers every real-world layout I could find (Dropbox, KeePassXC, Discord-style trays) with negligible cost —IconImageonly requests the next URL when the previous one errors.