Fix for missing desktop entries (Application Shortcuts) for apps installed as Snaps with snapcraft
Even though you have installed snaps correctly, you may not be able to view the application shortcuts in the Application Launcher (Start Menu) because of snapcraft’s conflict with other applications.
In this article, let us see how to fix the missing desktop entries ( application shortcuts) for the applications that are installed from the snap store and from the local machine.
Desktop Entries
In Linux, the menu items of Application Launchers are created through Desktop Entries. These are special text files that contain the name, display icon, execution path, and other key information of the application that controls its start-up behavior. The locations where the system has to look for these entries are managed by an environment variable named “XDG_DATA_DIRS
“. If the path is not part of this environment variable, we may not be able to view the links of those applications in the Application Launcher. This is the exact reason for the missing menu items of the apps that are installed as snaps through Snap Store or from local.
The Root Cause And The Fix
If you are using zsh as your primary shell, then you may face this issue as snapcraft doesn’t take into consideration of zsh configuration. With the default installation, desktop entries of snaps are located at “/var/lib/snapd/desktop
“. If you add this path to the “XDG_DATA_DIRS
” variable, the issue would be fixed.
List of Snaps Installed
The below is the screenshot of the list of snaps that are installed on my machine. The line items that are highlighted in yellow are the snaps that have desktop entries. All the other snaps are helper snaps.
In the below image, I am searching for an app named Fast Stone Image Capture (snap named as fsc in the above list). It is one of the popular screen capture applications for Windows. Although I use Flameshot and Spectacle in Linux, I missed this application a lot. So I created a snap for this Windows Application with Wine.
Configuration Steps
Follow the below steps to make changes to the variable “XDG_DATA_DIRS
“.
1. Edit the file “60x11-common_xdg_path
” located at /etc/X11/Xsession.d
by executing the command “sudo nano /etc/X11/Xsession.d/60x11-common_xdg_path
” in terminal.
2. Press the keys Ctrl + w
and search for export XDG_DATA_DIRS
. It would be somewhere around line 22, depending on the settings in your machine.
3. Just above that line, add XDG_DATA_DIRS=/var/lib/snapd/desktop:"$XDG_DATA_DIRS"
4. Save and exit the file ( Ctrl + x
and yes ).
5. Restart your machine and search for the installed snap, in Application Launcher.
6. If everything is fine, you can find the snaps in the Application Menu.
So, no more hassle of starting the snaps from the terminal despite having a GUI 🙂
Leave a comment