Desktop-launch command not showing GTK3 icons

I’m trying to finalize a snap for my Python script that uses GTK3. The issue is: my app runs, but the theme icons are missing.

In my snapcraft.yaml file, if I use this line:

command: desktop-launch $SNAP/bin/openresizer.py

My Python script opens up a GTK window, but with all the icons missing (it’s not able to find the Ambiant theme icons).

However, if I open a terminal and run python3 openresizer.py inside the snap folder, where my app is installed, the GTK window opens up and the icons are there.

How can I make this part run my script, so it sees the GTK3 theme icons? Or what am I doing wrong?

apps:
  openresizer:
    command: desktop-launch $SNAP/bin/openresizer.py
    plugs: [gnome-3-26-1604, x11, unity7, pulseaudio, wayland, desktop, desktop-legacy, gsettings, home, removable-media]

View my snapcraft.yaml file.

1 Like

You need to create snap dir then move these into it

* gui
* snapcraft.yaml

Also drop this line from snapcraft.yaml

* icon: gui/icon.png

Rebuild snap it should be working now.

My bad didn’t read issue clearly.

Can you try editing the openresizer app definition to include the following stanza:

environment:
  XDG_DATA_DIRS: $SNAP/share:$XDG_DATA_DIRS

The gtk-common-themes plugs look correct, but it isn’t clear GTK is configured to read the icon data shared by the snap.

Hi,

I tried your suggestion, and the icons still don’t show up in my app.
In the terminal, I get warnings, such as:
(openresizer.py:15291): Gtk-WARNING **: 18:43:53.358: Error loading theme icon 'list-add' for stock: Icon 'list-add' not present in theme Ambiant-MATE

Would it be because the desktop theme I’m using is Ambiant-MATE?
I’m using Ubuntu-MATE 18.04, and it’s the default theme.

Thanks.

I installed plain Ubuntu, using the default theme that it comes with (Yaru), and the icons still don’t show up.

(openresizer.py:12990): Gtk-WARNING **: 20:41:50.285: Error loading theme icon ‘window-close’ for stock: Icon ‘window-close’ not present in theme Yaru

How can I make my Python 3 GTK3 app use the default Ubuntu theme and GTK3 icons without getting a warning message?