A desktop entry file is a data file that provides information about an item in a menu. The desktop entry file specifies the details for the item such as a name, a command to execute, an icon, and so on. The desktop entry file also contains keywords which determine the location of the item in the menu hierarchy. Desktop entry files must reside in the $XDG_DATA_DIRS/applications directory and must have a .desktop file extension.
The order in which the default paths are searched to resolve the location of .desktop files is as follows:
Search in the $XDG_DATA_HOME/applications directory. If the $XDG_DATA_HOME environment variable is not set, search in the ~/.local/share/applications default directory.
Search the applications subdirectory of each directory in $XDG_DATA_DIRS. If the $XDG_DATA_DIRS environment variable is not set, search in the /usr/share/applications default directory.
If several .desktop files with the same name are found, the file that is found first takes precedence.
The following example shows a sample desktop entry file.
[Desktop Entry] Encoding=UTF-8 Name=Calculator Name[fr]=Calculatrice ... Comment=Perform calculations Comment[fr]=Effectue des calculs complique ... Exec=gcalctool Icon=accessories-calculator Terminal=false Type=Application StartupNotify=true Categories=GNOME;GTK;Utility;Calculator
The following table describes some of the important keys in desktop entry files. For more information about desktop entry files, see the XDG Desktop Entry Specification.
|
For more information about the keys in desktop entry files, see the desktop entry specification.