appstream/desktop file icon extraction missing

Bug #1814898 reported by Harald Sitter
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Claudio Matsuoka

Bug Description

Currently the icon.{png,svg} is not being properly extracted via appstream/desktop file information.

The current code expects the appstream data to contain something like `<icon type="local">assets/icon.png</icon>` which won't actually exist 99% of the time. The icon tags are almost exclusively injected by appstream-generator which is a distro-level tool that assembles "finalized" appstream. Part of this finalization is determining the actual icon files to use. For most applications the icon will be installed into an icon theme so the most suitable resolution is picked up.
As such the current icon support is largely useless :|

What needs to happen is the following:
- existing code to look for icon tag
- if no icon tag OR icon is not an absolute path OR absolute path doesn't exist in tree:
  - find desktop file (this may be set via <launchable> or inferred from <id> as is already the case in appstream.py)
  - get icon from desktop file
  - if icon is absolute path
    - use that
  - else
    - do an icon lookup [1] against the hicolor theme
    - (ideally one would actually be able to specify an additional "master" theme which is checked before hicolor; hicolor is the generic fallback but not necessarily the ideal visuals to use from a branding POV)

NB: beware that theme icons may be png, xpm, svg, or svgz. Raising an error when an unsupported format is found is likely required (also unzipping svgz may be handy).

Implementing this would also allow extending the current support so it not only supports `<icon type="local">` but also `<icon type="stock">` which is depending on the icon lookup.

[1] https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

Changed in snapcraft:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 3.2
Changed in snapcraft:
milestone: 3.2 → 3.3
Changed in snapcraft:
assignee: Sergio Schvezov (sergiusens) → Claudio Matsuoka (cmatsuoka)
tags: added: 19.04 19.04-blue
Revision history for this message
Claudio Matsuoka (cmatsuoka) wrote :

Could you provide a package to test/validate a fix proposal?

Revision history for this message
Harald Sitter (apachelogger) wrote :
Changed in snapcraft:
status: Triaged → In Progress
Changed in snapcraft:
milestone: 3.3 → 3.4
Revision history for this message
Claudio Matsuoka (cmatsuoka) wrote :

Proposed fix: https://github.com/snapcore/snapcraft/pull/2512

Result in the test package:
Icon=${SNAP}/usr/share/icons/hicolor/64x64/apps/kbruch.png

Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.