Ubuntu – Snap installed applications not showing on launcher

gnomegtk3snap

After installing applications using Snap (e.g: slack, chromium browser) they not appear in gnome launcher. Not able to run them using [gtk-launch][1] neither.

.desktop files exist in /var/lib/snapd/desktop/applications but somehow the are not recognized.

For instance, for Slack application, the .desktop file content is:

➜  cat /var/lib/snapd/desktop/applications/slack_slack.desktop 
[Desktop Entry]
X-SnapInstanceName=slack
Name=Slack
Comment=Slack Desktop
GenericName=Slack Client for Linux
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/slack_slack.desktop /snap/bin/slack %U
Icon=/snap/slack/14/usr/share/pixmaps/slack.png
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Network;InstantMessaging;
MimeType=x-scheme-handler/slack;

And, when trying to launch from the command line:

➜  gtk-launch slack_slack
gtk-launch: no such application slack_slack

When I execute /snap/bin/slack the application works fine.

Best Answer

  • This happens because /var/lib/snapd/desktop is not in XDG_DATA_DIRS.
    You can add it by putting

    export XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/snapd/desktop"
    

    or (if /etc/profile.d/snapd.sh exists in your system)

    source /etc/profile.d/snapd.sh
    

    in ~/.profile or in ~/.gnomerc.
    Of course you can also copy or symlink snapd *.desktop files from /var/lib/snapd/desktop/applications/ to one of the paths in XDG_DATA_DIRS or even to ~/.local/share/applications/.