DEV Community

Cover image for Better integrate your AppImage with .desktop file
Martin Niombela
Martin Niombela

Posted on

Better integrate your AppImage with .desktop file

All Linux distribution users are familiar with "AppImages": they are portable and do not require any prior installation. This is very convenient, but as it stands, the application does not appear in any of the computer's menus and is not necessarily detected by launchers.

This is where .desktop files come in. A .desktop file is simply a text file that tells the computer that an application exists and creates a new entry in the menu.

The basic

A basic .desktop file contains several informations about the application it describes :

  • [Desktop Entry]: Mandatory header, that indicates a menu entry
  • Type: "Application", "Link", or "Directory" (but here we want "Application")
  • Name: The name that will appear in the menu
  • Comment: The tooltip that shows when hovering over the icon.
  • Icon: The path to the icon of the app
  • Exec: The command to run to launch the app
  • Terminal: To know whether it should run from a terminal or not
  • Categories: To categorize the app (e.g., "Development", "Game", "Network")

This would look like this :

[Desktop Entry]
Type=Application
Name=MySuperApp
Comment=Super is my app
Icon=/home/YOUR_USER/Applications/my-super-app.png
Exec=/home/YOUR_USER/Applications/MySuperApp.AppImage
Terminal=false
Categories=Utility;
Enter fullscreen mode Exit fullscreen mode

⚠️ Exec and Icon don't understand relative paths. You need to use absolute paths for those fields.

Make it executable

To have a functional menu entry, the AppImage needs to be executable, meaning it has the permission to be executed. To do so, the following command can be used :

chmod +x /home/YOUR_USER/Applications/MySuperApp.AppImage
Enter fullscreen mode Exit fullscreen mode

Put it in the relevant folder

For your desktop to know where to find your menu entry, you can your freshly created file in ~/.local/share/applications/. The menu entry will be available for the user possessing the .desktop file.

It can also be placed in /usr/share/applications/, if all the user of the desktop should have the menu entry.

That's it

You should now see your app with its icon. You can now search for it, pin it to your dock, or launch it just like any other installed application.

Top comments (1)

Collapse
 
fred_functional profile image
Fred Functional

Nice, this is super clear and straight to the point. Love how you walked through a minimal .desktop example and mentioned the absolute path and permissions gotchas—those trip people up a lot. Really handy guide for keeping AppImages feeling like “real” apps in the desktop menu.