Custom symbolic icons not rendering in appimage

When I create an appimage and run the program on certain distros the custom icons don’t render properly. I looks like this:

The icons are inside a directory and i do:

    GtkIconTheme *theme = gtk_icon_theme_get_for_display(gdk_display_get_default());
    gtk_icon_theme_add_search_path(theme, "data/icons/");

Does anybody have experience with this?

Hi,

Probably you need a full absolute path for the icons folder.

It would be much better and reliable to ship your custom icons as gresource, see Themed Icons - GNOME Developer Documentation for details.

Switching to absolute paths doesn’t solve the issue, and I really don’t wanna use gresources.

It’s weird all an AppImage does is mount a file system and run the executable. The custom stylesheet, for instance, is being correctly loaded but the icons aren’t.

Could be interesting to print the current working directory when running your app, to make sure that the “data/icons” folder can be resolved relative to it.

I did that. It’s /tmp/weird_hash/data/icons

I don’t think it has to do with file paths, because then it wouldn’t work on any distro. It works on linux mint, for example, but not on fedora.

If you’re interested here is the compiled exe and appimage. I use linuxdeploy to create the dependencies: GitHub - zagortenay333/temp

And here is the source: GitHub - zagortenay333/kronomi

Ok, I just tested this with gresource, and I still got the same problem. Even when the icons are bundled in a gresource they don’t render on distros like fedora and manjaro, but do render on ubuntu based distros.

Then I’m clueless…

Do you follow the correct icons folders structure? like:

data/icons/hicolor/scalable/actions/mycustomicon-symbolic.svg

I use data/icons/hicolor/symbolic/apps which i believe is also correct. Again, the weird thing is it works on some distros.

Are these custom icons only provided inside the appimage, or also installed somewhere on the local system?

Can you please compare the file /usr/share/icons/hicolor/index.theme on both Mint and Fedora, and check if there are any difference?

The icons are only inside the appimage.

The two index.theme files are identical.

I just made two additional interesting observations:

  1. When calling the function gtk_icon_theme_has_icon(theme, “kronomi-question-symbolic”) on fedora (where the icons don’t render), it returns true.
  2. When you open the gtk inspector (ctrl+shift+d) and you manually change the name of an icon to say folder-symbolic (all my icons starts with kronomi) it correctly renders that icon.

Btw gwillems, did you try to run the appimage on your machine? Do the icons show up?

I noticed that linuxdeploy has a gtk plugin. I updated the repo containing the appimage; it now contains more libraries, but sadly this still doesn’t fix the issue: GitHub - zagortenay333/temp

Does nobody really have a clue what’s going on?

Alright finally had a breakthrough thanks to chatGPT!

Placing the line export GDK_PIXBUF_MODULE_FILE="usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" into the AppRun script solves the problem.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.