.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
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
- You can specify several languages with
[language-code], for example:
Comment[es]=Mi maravilloso programa.
Categoriesis 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
- 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