.desktop files (I): adding programs to your Applications Menu
When you install some GUI software, a shortcut will appear in your Applications Menu. But if it is a portable program (like an AppImage or a simple script) you can add it manually by creating a .desktop file.
These custom .desktop files are located inside $HOME/.local/share/applications/
(those added directly by the program are usually inside /usr/share/applications/
).
A .desktop file can be very simple:
# $HOME/.local/share/applications/myprogram.desktop
[Desktop Entry]
Type=Application
Name=MyProgram
Comment=This is my awesome program
Categories=Utility
Exec=/path/to/myprogram
- This is the most basic structure, you can also add an icon (
Icon=/path/to/icon.png
). Icon path can be an absolute path or simply a filename if the icon is inside$XDG_DATA_DIRS/icons
or/usr/share/pixmaps
. - You can specify several languages with
[language-code]
, for example:Comment[es]=Mi maravilloso programa
. Categories
is a list of strings (separated by semicolon). Here you can find a list of well-known categories.- You can run command line programs by adding
Terminal=true
. - If the app requires to type root password to use it, you can add a Polkit rule or use ‘sudo’ (it will display a terminal prompt to type user password):
Terminal=true Exec=sudo /path/to/program
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: