Skip to content

An icon the desktop can actually draw - #50

Merged
blessdyb merged 3 commits into
mainfrom
fix/an-icon-the-desktop-can-draw
Oct 1, 2026
Merged

blessdyb merged 3 commits into
mainfrom
fix/an-icon-the-desktop-can-draw

Conversation

@blessdyb

@blessdyb blessdyb commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Shipping as v0.5.15. Reported from the desktop: the application icon does not render in Ubuntu.

Everything looked right

The file was installed where it belongs, desktop-file-validate passed, all three names agreed, and GTK's icon theme resolved the name to the file:

has com.xinbetween.Flowlight: True
resolves to: /usr/share/icons/hicolor/scalable/apps/com.xinbetween.Flowlight.svg

has_icon consults an index. It never draws anything. Asking the loader to actually draw it:

gdk-pixbuf-error-quark: Couldn't recognize the image file format for file
"/usr/share/icons/hicolor/scalable/apps/com.xinbetween.Flowlight.svg"

The cause

gdk-pixbuf recognises a file by sniffing its first bytes, and its SVG loader looks for <svg near the start. This icon opened with a nine-line comment explaining the drawing, which put <svg 501 bytes in:

file <svg at byte result
a working system icon 55 loads
ours 501 "couldn't recognize the image file format"
ours, comment removed 40 loads

The file was valid SVG the whole time — it parses, and rsvg-convert renders it happily. Nothing warns about this. The comment that broke it ended with the words "nothing in the packaging depends on what is in here".

The fix

The comment moved inside the element, where it says the same things and now also says this.

The check

CI draws the icon on every push, through gdk-pixbuf, because that is the only thing that sees the bug:

  • rsvg-convert parses the file directly, accepts the broken one and exits 0 — a check built on it proves nothing.
  • gdk-pixbuf-thumbnailer warns about the broken file and still exits 0 — so the check looks at whether a PNG came out, not at the exit status.

Against the broken file, none does: no output file at all. Against the fixed one, 1,865 bytes of PNG. Both were run on a real Ubuntu desktop before this check was written.

🤖 Generated with Claude Code

blessdyb and others added 3 commits October 1, 2026 08:52
Reported from the desktop: the application icon does not render. The file was installed where it belongs,
the desktop entry validated, and GTK's icon theme resolved the name to the file — `has_icon` said true.
It had never drawn it. `has_icon` consults an index; it does not load anything.

gdk-pixbuf recognises a file by sniffing its first bytes, and its SVG loader looks for `<svg` near the
start. This icon opened with a nine-line comment explaining the drawing, which put `<svg` 501 bytes in:

    a working system icon   <svg at byte  55   loads
    ours                    <svg at byte 501   "couldn't recognize the image file format"
    ours, comment removed   <svg at byte  40   loads

The file was valid SVG the whole time, and nothing warns about this. The comment that broke it ended with
the words "nothing in the packaging depends on what is in here".

So the comment moved inside the element, where it says the same things and also says this. And CI now
draws the icon on every push, through gdk-pixbuf, because that is the only thing that sees the bug:
`rsvg-convert` parses the file directly and accepts the broken one, and `gdk-pixbuf-thumbnailer` warns
about it and still exits 0. The check looks at whether a PNG came out. Against the broken file none does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The next person to improve this icon will put a comment at the top of it, because that is where comments
go. Said beside the other things about the window that are not obvious from the code.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The window fix and the icon fix touched the same three files and neither is about the other: the version
becomes 0.5.15, and the README keeps what each of them had to say.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@blessdyb
blessdyb merged commit ac7360a into main Oct 1, 2026
18 checks passed
@blessdyb
blessdyb deleted the fix/an-icon-the-desktop-can-draw branch October 1, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant