How to create entries for desktop and menu with icon (.svg or .png) on snapcraft?

Hello developers!

I have a question, my software it in development stage, I do tests and updates them when I have time. My next step is create entries for desktop and menu. I created a file .desktop and all the config information him. In my PC it work good, but when I upload on GitHub for release on snapcraft, the snap don’t use my file, It create the menu entry, but not for desktop.

I guess that problem is on my snapcraft.yaml file, there I use a comand for execute on terminal the main file .py of software, but I don’t know how do a desktop entry.

How can I do the snapcraft to use my .desktop file?

Down it the code of .desktop and .yaml file:

The desktop file needs to be in the folder snap/gui, it needs to start with the name of your app (gerenciadorcs.desktop) and the exec field needs to be the name of the app (gerenciadorcs).

During installation of the snap, snapd will then create a menu entry based on that file.

This is explained in more detail here:


Thank you, with your help I could solve.

That’s not entirely accurate. While putting a .desktop file in snap/gui will work, there is also the option apps.$appname.desktop that you can set in the yaml to point to the desktop file in the snap:

        command: usr/bin/gimp
        desktop: usr/share/applications/gimp.desktop