Application icon not found, even though it's installed

I’m having a problem with the application icon, when the app starts, it outputs:

Gtk-WARNING **: 08:49:27.094: Failed to load icon /run/host/share/icons/hicolor/scalable/apps/io.github.otaxhu.MQTTy.Devel.svg: Error opening file /run/host/share/icons/hicolor/scalable/apps/io.github.otaxhu.MQTTy.Devel.svg: No existe el fichero o el directorio

I tested it in both flatpak and host (fedora) environments, according to documentation, the application icons are searched under ${XDG_DATA_DIRS}/icons/hicolor/scalable/apps/APPID.svg

In GTK Inspector, the XDG_DATA_DIRS env variable has this value (in flatpak):

app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/run/host/share

The icon is installed under /app/share but the application just ignores it and skips up to the last component /run/host/share

How the icon is installed

I’m just using Meson’s install_data function, with arguments:

prefix = get_option('prefix')
datadir = prefix / 'share'
iconsdir = datadir / 'icons'

install_data(
    'icons/scalable/apps/@0@.svg'.format(application_id),
    install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps',
)

The option prefix has the value /app when running under flatpak-builder command and /usr/local when running on host

Are you sure application_id has the value io.github.otaxhu.MQTTy.Devel?

Yes, I have it as a variable initialized like this:

base_id = 'io.github.otaxhu.MQTTy'

if get_option('profile') == 'development'
  application_id = '@0@.Devel'.format(base_id)
else
  application_id = base_id
endif

And profile option is development, since is harcoded in flatpak manifest

Does that mean you have a meson_options.txt with something equivalent to:

option(
  'profile',
  type: 'combo',
  choices: [
    'release',
    'development',
  ],
  value: 'release',
)

If you have the code uploaded somewhere, that’d help debug this.

positive, I do have something similar.

The repository is GitHub - otaxhu/MQTTy: MQTTy - A Native GUI MQTT Client

In the last commit from main branch, I’m building the flatpak manifest under build-aux/io.github.otaxhu.MQTTy.Devel with the command:

cd build-aux && flatpak-builder --user --install --force-clean  app io.github.otaxhu.MQTTy.Devel

Really weird, the app icon is there for me:

Are you sure all build cache is cleared? (.flatpak-builder as well as app)

edit: If you meant that main works, but not your new approach, could you make a temporary branch?

No, I meant that it’s not working with that command.

In that specific window I get the “not found” icon (The square one with an exclamation mark)

No luck

I tried flatpak uninstall --delete-data io.github.otaxhu.MQTTy.Devel and removing the .flatpak-builder and app directories

I’m a bit confused though, because the code you posted isn’t the same as the code in main?

No, it isn’t, it was just how I remembered it.

This is how the app flatpak directory looks like

It seems that both icons are correctly installed.

I’m not sure, you’re correct, they’re installed correctly, and the output of XDG_DATA_DIRS is also correct, and it even works on my machine. Somehow the lookup is at the wrong place for you, but I wouldn’t know what causes that, sorry.

Thank you @monster for testing the app.

Solved the problem, it was a cache icon problem in a previous installation of the app I had in /usr prefix (in normal cases nobody should install any app in that prefix).

I uninstalled the app, but the cache wasn’t cleared, I guess the OS though that the icon was still there, but it wasn’t.

Just ran the command and it worked in both flatpak and host environment:

sudo gtk_update_icon_cache -f /usr/share/icons/hicolor
1 Like