Desktop-launch command not showing GTK3 icons


#1

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.


#2

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.


#3

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.


#4

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.