DEV Community

tq-bit
tq-bit

Posted on • Edited on

How to register an AppImage as a desktop application in Linux

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

Let's do it.

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

  1. Download the .AppImage file and an icon you would like to register it with
  2. Move the .AppImage file to the path /bin, e.g. sudo mv ~/Downloads/Marktext.AppImage /bin/
  3. Make it executable with sudo chmod +x /bin/Marktext.AppImage
  4. Save the icon under /usr/share/icons/custom/markdown.png e.g. sudo mkdir --parents /usr/share/icons/custom && sudo mv ~/Downloads/markdown.png /usr/share/icons/custom/
  5. Create a .desktop file under ~/.local/share/applications/marktext.desktop
  6. Paste the following content into it (make sure to remove the comments):


[Desktop Entry]
Name=Mark Text
Comment=Next generation markdown editor
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=Office;TextEditor;Utility;
MimeType=text/markdown;
Keywords=marktext;markdown;               # add searchable keywords
StartupWMClass=marktext
Actions=NewWindow;


Enter fullscreen mode Exit fullscreen mode

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

Hitting enter should then start up your application.

Top comments (1)

Collapse
 
websilvercraft profile image
websilvercraft

Nowdays in ubuntu, you have AppImageLauncher, which handles it automatically when you click on an AppImage file.