Desktop file

I am trying to get my snap to shows in the launcher/apps list

I created a desktop file as follows:

 [Desktop Entry]
 Name=PocSharp
 Exec=poc-sharp

and in my snapcraft.yaml I added the desktop: property

apps:
  poc-sharp:
    command: bin/desktop-launch $SNAP/PocSharpGui
    desktop: poc-sharp.desktop
    plugs:
      - desktop
      - desktop-legacy
      - wayland
      - x11
      - unity7
      - gsettings
      - network

The snap installs without error and I can see the desktop file in /snap/poc-sharp/current

But it still doesn’t appear.

If everything is working, snapd should have installed a processed version of the desktop file to /var/lib/snapd/desktop/applications/poc-sharp_poc-sharp.desktop.

If this desktop file exists but isn’t being picked up, open a terminal and check to see if /var/lib/snapd/desktop is included in the output of echo $XDG_DATA_DIRS. If it is, then I’m not sure what is going on. If it isn’t, then it would be helpful to know what desktop shell you’re using.

Yes that file exists:

 cat /var/lib/snapd/desktop/applications/poc-sharp_poc-sharp.desktop 

[Desktop Entry]
X-SnapInstanceName=poc-sharp
Name=PocSharp
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/poc-sharp_poc-sharp.desktop /snap/bin/poc-sharp %U

echo $XDG_DATA_DIRS
/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop

I’m using the default Ubuntu 18.04.2 LTS which is gnome shell I think.

Does it need to have an icon to show up?

You’re missing the Type key in your desktop file. Here is a list of the various keys you can set in your desktop file.

https://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys

Note that Type is listed as required. In your case, you want Type=Application.

1 Like