Adding a desktop Icon to my snap

Check out the code in the ‘snap’ folder of my project here on github;

In the snap folder I added a ‘gui’ folder with shenko.desktop and the icon.png
in the snapcraft.yaml I pointed to the shenko.desktop

From what I understand this gets installed in snapd folder on the end users
computer and in order to get the Logo and desktop to work I need to make
either a symlink with the ln command in ‘usr/share/applications’
I’ve seen the use of sed to do some hokey pokey magic stuff.

Either one has not worked for me, I’m just missing something but I
don’t know what and I’m at my wits end here.

Any help would be greatly appreciated, thank you in advance.


Danny Dowshenko

Failed to generate snap metadata: The path ‘path/to/my/project/shenko/snap/prime/usr/share/applications/shenko.desktop’ set for ‘desktop’ in ‘shenko’ does not exist. Make sure that the files are in the prime directory.

Here is the Error message that haunts my dreams at night

Your snapcraft.yaml file’s parts section doesn’t say to install anything, so later steps in the build don’t find anything.

Since it appears to be a Python project, you could start with:

    plugin: python
    source: .

As far as handling desktop files, there’s two options:

  1. Place a .desktop file in snap/gui under your project root. It will be copied verbatim into your snap.
  2. Use the desktop: key for one of your snap’s apps. This should reference a .desktop file outside of snap/gui installed by one of your parts. Snapcraft will install a modified and renamed version of that desktop file in your snap.

You seem to be doing a bit of (1) and a bit of (2). It would be best to pick one method and stick with it.

1 Like

By the way, I suggest you remove snap/snap/gui and keep snap/gui.

Just of the sake of cleaning up.

guys, thank you so much for your input. I really appreciate all the help.
@dimitri, I noticed the extra folders after I pushed the changes. It was late I just passed out on my keyboard. lol. but yeah good looking out. I will fix that right up.

@jamesh, Thank you for pointing me in the right direction. I’m gonna give it another go tonight. I was confused by the whole yaml syntax. what is apps and what is parts, but I read up on it and im starting to understand a little better.

Thanx again you guys.

I’d suggest having a read through the documentation, which describes what the various parts of the snapcraft.yaml file do:

In short, the parts section describes how to build and organise the files that will be included in your snap, and the apps section defines the entry points (command line tools, desktop applications, daemons, etc) made available by the snap once it is installed.

Roger Wilco,

I’m going to go through it. I’m jumping from web development to python to sql to yaml, I just wish we had one language that does it all. What a world that would be huh?

Have a great day,

1 Like