Register an AppImage as a desktop application in Linux

Refer: https://dev.to/tqbit/how-to-register-an-appimage-as-a-desktop-application-in-linux-31c7

The Scenario:

You have an .AppImage file and would like to treat it like an installed Linux app.

The solution:

Create a custom .desktop file

For this article, I'll use the following constraints:

  • Register the Electron.js app Marktext on an Ubuntu 20.04 distro
  • Use this icon from icon-library.com or some other place

Let's do it.

NOTE: You might have to use sudo commands to access files in the /bin and /use directories

  • Download the .AppImage file and an icon you would like to register it with
  • Move the .AppImage file to the path /bin, e.g. sudo mv ~/Downloads/Marktext.AppImage /bin/
  • Make it executable with sudo chmod +x /bin/Marktext.AppImage
  • Save the icon under /use/share/icons/custom/markdown.png e.g. sudo mkdir --parents /use/share/icons/custom && sudo mv ~/Downloads/markdown.png /use/share/icons/custom/
  • Create a .desktop file under ~/.local/share/applications/marktext.desktop
  • Paste the following content into it:
[Desktop Entry]
Name=Image Name                           # NAME YOUR IMAGE HERE
Comment=What this program does            # COMMENT ABOUT USAGE
Exec=/bin/marktext-x86_64.AppImage        # REPLACE WITH YOUR .AppImage
Terminal=false
Type=Application
Icon=/usr/share/icons/custom/markdown.png # REPLACE WITH YOUR ICON
Categories=Utility                        # SET THE CATEGORY, CAN HAVE MULTIPLE ENTIRES SEPARAGED BY ;
MimeType=text/markdown;                   # SET MimeType
Keywords=marktext;markdown;               # ADD SEARCHABLE KEYWORDS
StartupWMClass=filename.AppImage          # USE PROGRAM BINARY NAME HERE
Actions=NewWindow;

That should do it. Try pressing the Super key now and search for the app.