How to create a desktop entry for an AppImage

I've been using Fraidycat as an RSS reader for some time. The project puts out an AppImage as a release asset, which is a neat way for distributing software on Linux because it does not need root privileges to install things in system directories.

After making a Software.AppImage file executable with chmod +x, we can easily execute it like any other script!


  $ ./Software.AppImage

But since I didn't want to open Fraidycat from the terminal (and use the Launcher instead), I looked into how I could create an "icon" for the AppImage. Turns out there's a whole XDG Desktop Entry spec to do just that!

To create a desktop entry for an executable/AppImage, we just need to create a .desktop file like this:


  $ cat Fraidycat-1.1.7.desktop
  [Desktop Entry]
  Encoding=UTF-8
  Name=Fraidycat
  Comment=Follow everything from a single page.
  Exec=/home/vinayak/software/Fraidycat-1.1.7.AppImage %F
  Icon=/home/vinayak/pictures/flatcat-512.png
  MimeType=application/x-iso9660-appimage;
  Type=Application
  Categories=Utility;Application;

We put the path to the AppImage in the Exec key, the path to an icon for the desktop entry in the Icon key, set the MimeType to application/x-iso9660-appimage, and fill in some other metadata keys. After that we can just install the .desktop file in our applications directory, and update the desktop database like this:


  $ desktop-file-install --dir=$HOME/.local/share/applications Fraidycat-1.1.7.desktop
  $ update-desktop-database ~/.local/share/applications

And voila! We get a desktop entry in the Launcher!

fraidycat

Both desktop-file-install and update-desktop-database utilities are available in the desktop-file-utils package, which comes pre-installed on Ubuntu.