Automatically copy .desktop file to .local/share/applications


#1

When I install a snap its .desktop icon is copied to: /var/lib/snapd/desktop/applications/
But it won’t appear in the GNOME’s results for launching applications until I manually copy it to either /usr/share/applications or ~/.local/share/applications

Is there a way to make the .desktop files of installed snaps be copied to GNOME’s /usr/share/applications folder automatically?


#2

Try adding a desktop entry under the apps entry, so that you have something that looks like:

apps:
    my-app:
        command: usr/bin/my-app
        desktop: usr/share/applications/my-app.desktop

If you are using appstream, there are a couple of other features coming that simplify this story Adopt info from other metadata sources


#3

In which file should I do that?
Notice I’m not developing an app for Snap, I’m a user, I’m only installing
apps from the Snap store.


#4

Sorry, I was speaking from a developer’s point of view, as a user, ensure /var/lib/snapd/desktop is part of XDG_DATA_DIRS.

If you installed snapd and immediately installed a snap following this they would not show up given how environment variables work but session logout followed by a login would remediate this.


#5

Thanks! Will try that.