I’m making this topic for anyone else that might find themselves in the same position I was in and not wanting to settle with having to symbolically link snapd .desktop files to their .local/share/applications directory. I’m also hoping the snapd dev team might come across this post and implement a change to solve this issue.
To start off, here’s some of my relevant system specifications:
- OS: Parrot OS Home (based on Debian Linux)
- Desktop: Xfce
- Shell: Z Shell
My issue: After doing a fresh install of Parrot and switching to Z Shell as my default shell, I installed snapd and used it to install the Spotify and VSCode snaps. While I could run these applications from the command line, the application launchers (which I found out were located in the applications folder within the /var/lib/snapd/desktop directory) were not being shown in either of my applications menus.
I’ve spent a few days figuring out exactly why this was occurring and how to go about fixing it, and after reading quite a few different posts on this topic, I finally discovered a fix that didn’t involve me having to put in a script somewhere symbolically linking the .desktop files located in snapd’s desktop directory to my .local/share/applications directory. The applications aren’t shown because Zsh doesn’t use any of the files located in /etc/profile.d/ and so the /etc/profile.d/apps-bin-path.sh file that’s supposed to include /var/lib/snapd/desktop in $XDG_DATA_DIRS (the environment variable that tells the system where to look for these .desktop application files) doesn’t get used. I tried using
emulate sh -c ‘/etc/profile.d/apps-bin-path.sh’
to emulate apps-bin-path.sh file, but for whatever reason (could’ve been because I wasn’t putting it in the right config file, I tried putting it in /etc/zsh/zprofile like one person on a thread suggested but that didn’t do anything) I still wasn’t seeing the snapd applications directory showing up in $XDG_DATA_DIRS when trying that method.
How I fixed this: I came across a thread mentioning a change that was made to take out the 65snappy file that used to be installed in /etc/X11/Xsession.d/ and found the file on github.
I then simply created the same file within /etc/X11/Xsession.d/ and pasted the code found in the above link in it. After deleting all my symlinks inside my ~/.local/share/applications directory and restarting the session, the directory was set in XDG_DATA_DIRS and my snap installed applications were showing up (and after installing a new application I wouldn’t have to logout and log back in to have the application appear in my app menu)
I hope this helps anyone else dealing with the same problem. Thanks.