75

Just updated to Ubuntu 16.04 & trying snap packages for first time.

So I needed meshlab to view some stl files. Ran in to issue with p-i-t-n log in. Found that command line install of snap packages does not need the log in. Did:

sudo snap install meshlab

and hey presto meshlap installed, no pitn log in. Works fine from command line. However program does not show up in the launcher. Why is this? Do snap packages not show up in launcher? How can I fix this?

pomsky
  • 70,557
Ron
  • 899

18 Answers18

82

If you are using zsh, the snap binary and desktop directories will not automatically be added to your environment variables. In order to solve this, I added the following line to /etc/zsh/zprofile (taken from Arch):

emulate sh -c 'source /etc/profile'

This will process your /etc/profile file with bash emulation, which in turn sources /etc/profile.d/* and sets the proper PATHs, etc.

To add only the snap directories to your path, without including all the rest of the default bash profile:

emulate sh -c 'source /etc/profile.d/apps-bin-path.sh'
muru
  • 207,228
hackel
  • 1,104
24

Copy applications shortcut from /var/lib/snapd/desktop/applications/ to /usr/share/applications/

Example: sudo cp /var/lib/snapd/desktop/applications/brave_brave.desktop /usr/share/applications/

I had to do this on GalliumOS 3.0 (Xubuntu-based)

J.T.
  • 397
21

For me, it also seems to be related to the combination of Wayland/ZSH under Ubuntu 18.04 - even though /var/lib/snapd/desktop is listed in the XDG_DATA_DIRS variable (this is done by /etc/profile.d/apps-bin-path.sh), the launcher doesn't recognize apps from that folder.

A quick workaround is to sym-link the desired desktop files, for example:

ln -s /var/lib/snapd/desktop/applications/rubymine_rubymine.desktop .local/share/applications
David Foerster
  • 36,890
  • 56
  • 97
  • 151
dsager
  • 311
20

It's built into the snap system, but you have to add the link to your dash. To start the program type

snap run meshlab

once it's up and running, right click on the icon and click on "add to dash".

Pyroglyph
  • 2,260
14

Running Kubuntu 18.04 the solution for me was adding

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

to a custom file like snap-apps.sh in ~/.config/plasma-workspace/env. But that applies only to Plasma 5 and might be fixed in Ubuntu 18.10 already.

As dsager's answer already mentioned the usual /etc/profile.d/apps-bin-path.sh does not seem to work.

Zanna
  • 72,312
10

For me help command

ln -s /var/lib/snapd/desktop/applications ~/.local/share/applications/snap

This link folder with snap application shortcuts to my local folder. And now I can run snap applications as other.

newman
  • 201
6

Do snap packages not show up in launcher?

They do as long as the snap ships proper .desktop files. Only Meshlab's meshlabserver has a proper desktop file (and indeed, it shows up in my launcher). The meshlab .desktop file, however, is attempting to exec meshlab.meshlab, when it should just be using meshlab. As a result, it doesn't show up.

How can I fix this?

If you run snap info meshlab you'll see contact info for the publisher. I suggest you report a bug to them. Until then, you can always run meshlab from the CLI, or create your own .desktop file for it.

kyrofa
  • 7,502
5

I couldn't comment on someone else's post. However, this is to add to dsager's answer which helped me on Fedora 28 (which as far as I can tell, uses Wayland)

I added the following snip to my ~/.bash_profile to link on login each file in /var/lib/snapd/desktop/applications. Similarly this could be modified to remove the links for apps which do not exist anymore by switching the paths in the for line and the if line then replacing ln with an rm.

for i in /var/lib/snapd/desktop/applications/*.desktop; do
    if [ ! -f ~/.local/share/applications/${i##*/} ];then
            ln -s /var/lib/snapd/desktop/applications/${i##*/} ~/.local/share/applications/${i##*/};
    fi;
done

There's probably a handful of different ways to accomplish this, but it works.

3

Snap binaries are stored in /snap/bin, at least in Debian 10 (buster). Add the directory to $PATH and reload bash profile, ~/.bashrc.

echo -n "export PATH=/snap/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc
3

You have to run snap run meshlab from terminal and stop it, then you will see Meshlab in your application list

1

On my machine all snaps that are installed only show in the launcher after I log off and back on. I just installed Krita and Standard Notes. Logged off and back on and it was in the launcher. Same thing with Spotify.

Squid
  • 11
1

I was having an issue that after I installed zsh, none of my Snap packages were showing up in the start menu, or on my Latte Dock on KDE (no apps were showing up even though they existed).

What fixed it was one of the answers above.

I did:

sudo cp /var/lib/snapd/desktop/applications/* /usr/share/applications/

You may need to restart your computer after doing it to cause the apps to show.

1

In my case, the first time Kate editor is installed via snap on Mint, it shows the icon in Menu launcher and Panel launcher.

But the icon disappears after a recent snap automatically update. Looking at H2onvety's answer, I tried to edit its desktop file with menu editor, found it's point to an old version of the kate editor which does not exist on the system anymore(Icon=/snap/kate/158/meta/gui/icon.png). Then I change it to Icon=/snap/kate/current/meta/gui/icon.png, and the icon in the Menu launcher comes back, unpin and re-pin it to the Panel fix the Panel launcher icon not showing problem.

bzt
  • 11
  • 2
1

Same thing with blender.

snap run blender

does work, however did not fix the problem.

I had to copy blender.desktop from /snap/blender/current/blender.desktop to /usr/share/applications (with sudo) and then all was fixed: blender shows in the gnome menus and nautilus associates it with .blend files.

Looks like some sort of crack between snaps and gnomes to me. Perhaps what we need is a snappy gnome (or is it a gnomey snap ;^).

Zanna
  • 72,312
0

I ran in to the same issue on Ubuntu 18.04. It seems to be a problem with Wayland. The solution for me was to switch back from Wayland to Xorg.

romaind
  • 101
0

I have the regular bash-shell (not zsh) in Kubuntu 21.10 and I had this problem with one snap only (Opera) while others were visible in launcher.

Here is a GUI way to manually solve the problem in KDE Plasma:

Open with text-editor the .desktop-file of the program in

/var/lib/snapd/desktop/applications

enter image description here

and copy the path of the executable to "Command:" in KDE Menu Editor (opens when you right-click launcher and choose Edit Applications).

From the .desktop-file also notice the path to location of the icon of the program and in KDE Menu Editor browse to that location (if you don't find a suitable icon from current icon theme).

enter image description here

H2onvety
  • 332
0

This script worked for me, based on previous questions. It creates .desktop links for all snap applications.

My environment is Ubuntu Server + i3 + Nautilus

#!/bin/bash

Source directory where Snap stores .desktop files

source_dir="/var/lib/snapd/desktop/applications"

Target directory where symbolic links will be created

target_dir="$HOME/.local/share/applications"

Ensure the target directory exists

mkdir -p "$target_dir"

Loop through all .desktop files in the source directory

for desktop_file in "$source_dir"/*.desktop; do

Get the base name of the .desktop file

file_name=$(basename "$desktop_file")

Create a symbolic link in the target directory

ln -s "$desktop_file" "$target_dir/$file_name" done

echo "Symbolic links created for all Snap applications."

0

Flatpak solves this issue with a file at /etc/X11/Xsession.d/20flatpak, which adds the desktop application shortcuts to XDG_DATA_DIRS. A copy of this file also lives under /etc/profile.d/flatpak.sh. Presumably, the former is for your desktop environment and the later is for your terminal session.

As others have already mentioned, snapd ships with a file at /etc/profile.d/apps-bin-path.sh but not the corresponding copy in /etc/X11/Xsession.d. So the fix is as simple as:

$ sudo cp /etc/profile.d/apps-bin-path.sh /etc/X11/Xsession.d/20snap

I like this approach because it's consistent with flatpak and should be relatively easy to find when I wonder how I fixed it a year from now.

Big McLargeHuge
  • 839
  • 1
  • 9
  • 15