Writing a .desktip file

A .desktop file is essentially an INI-style config file that tells Linux how to launch an application and how to display it in menus.

Here is an example with common configuration:

[Desktop Entry]
Name=My App
Exec=/path/to/my-executable
Icon=/path/to/my-app-icon
Type=Application
Categories=Utility;
Comment=My custom application
Terminal=false

The example.desktop file is usually placed in "~/.local/share/applications/example.desktop". Most desktop environments will automatically add it to your app menu when saved here.

If the file contains a "MimeType=" entry, update the MIME database with:

$ update-desktop-database ~/.local/share/applications

To remove the entry, simply delete the file:

$ rm ~/.local/share/applications/example.desktop

If your .desktop file is stored elsewhere, you can install it with:

$ xdg-desktop-menu install --mode user example.desktop --register-app

And remove it with:

$ xdg-desktop-menu uninstall --mode user example.desktop