Recognized desktop entry keys

Keys with type localestring may be postfixed by [LOCALE], where LOCALE is the locale type of the entry. LOCALE must be of the form lang_COUNTRY.ENCODING@MODIFIER, where _COUNTRY, .ENCODING, and @MODIFIER may be omitted. If a postfixed key occurs, the same key must be also present without the postfix.

When reading in the desktop entry file, the value of the key is selected by matching the current POSIX locale for the LC_MESSAGES category against the LOCALE postfixes of all occurrences of the key, with the .ENCODING part stripped. The .ENCODING field is used only when the value of the Encoding key for the desktop entry file is Legacy-Mixed (see Appendix D, The Legacy-Mixed Encoding (Deprecated).)

The matching of is done as follows. If LC_MESSAGES is of the form lang_COUNTRY.ENCODING@MODIFIER, then it will match a key of the form lang_COUNTRY@MODIFIER. If such a key does not exist, it will attempt to match lang_COUNTRY followed by lang@MODIFIER. Then, a match against lang by itself will be attempted. Finally, if no matching key is found the required key without a locale specified is used. The encoding from the LC_MESSAGES value is ignored when matching.

If LC_MESSAGES does not have a MODIFIER field, then no key with a modifier will be matched. Similarly, if LC_MESSAGES does not have a COUNTRY field, then no key with a country specified will be matched. If LC_MESSAGES just has a lang field, then it will do a straight match to a key with a similar value. The following table lists possible matches of various LC_MESSAGES values in the order in which they are matched. Note that the ENCODING field isn't shown.

Table 1. Locale Matching

LC_MESSAGES valuePossible keys in order of matching
lang_COUNTRY@MODIFIER lang_COUNTRY@MODIFIER, lang_COUNTRY, lang@MODIFIER, lang, default value
lang_COUNTRY lang_COUNTRY, lang, default value
lang@MODIFIER lang@MODIFIER, lang, default value
lang lang, default value

For example, if the current value of the LC_MESSAGES category is sr_YU@Latn and the desktop file includes:

 Name=Foo
 Name[sr_YU]=...
 Name[sr@Latn]=...
 Name[sr]=...

then the value of the Name keyed by sr_YU is used.

Case is significant. The keys Name and NAME are not equivalent. The same holds for group names. Key values are case sensitive as well.

Keys are either OPTIONAL or REQUIRED. If a key is optional it may or may not be present in the file. However, if it isn't, the implementation of the standard should not blow up, it must provide some sane defaults. Additionally, keys either MUST or MAY be supported by a particular implementation.

Some keys only make sense in the context when another particular key is also present.

Some example keys: Name[C], Comment[it].

Table 2. Standard Keys

KeyDescriptionValue TypeREQ?MUST?Type
Type There are 4 types of desktop entries: Application, Link, FSDevice and Directory. stringYESYES
Version Version of Desktop Entry Specification (While the version field is not required to be present, it should be in all newer implementations of the Desktop Entry Specification. If the version number is not present, a "pre-standard" desktop entry file is to be assumed). numericNOYES1-4
Encoding Encoding of the whole desktop entry file (UTF-8 or Legacy-Mixed). stringYESYES1-4
Name Specific name of the application, for example "Mozilla". localestringYESYES1-4
GenericName Generic name of the application, for example "Web Browser". localestringNOYES1-4
NoDisplay NoDisplay means "this application exists, but don't display it in the menus". This can be useful to e.g. associate this application with MIME types, so that it gets launched from a file manager (or other apps), without having a menu entry for it (there are tons of good reasons for this, including e.g. the netscape -remote, or kfmclient openURL kind of stuff). booleanNONO1-4
Comment Tooltip for the entry, for example "View sites on the Internet", should not be redundant with Name or GenericName. localestringNOYES1-4
Icon Icon to display in file manager, menus, etc. If the name is an absolute path, the given file will be used. If the name is not an absolute path, an implementation-dependent search algorithm will be used to locate the icon. Icons may be localized with the Icon[xx]= syntax. stringNOYES1-4
Hidden Hidden should have been called Deleted. It means the user deleted (at his level) something that was present (at an upper level, e.g. in the system dirs). It's strictly equivalent to the .desktop file not existing at all, as far as that user is concerned. This can also be used to "uninstall" existing files (e.g. due to a renaming) - by letting make install install a file with Hidden=true in it. booleanNONO1-4
FilePattern A list of regular expressions to match against for a file manager to determine if this entry's icon should be displayed. Usually simply the name of the main executable and friends. regexp(s)NONO1
TryExec File name of a binary on disk used to determine if the program is actually installed. If not, entry may not show in menus, etc. stringNONO1
Exec Program to execute, possibly with arguments. stringNOYES1
Path If entry is of type Application, the working directory to run the program in. stringNOYES1
Terminal Whether the program runs in a terminal window. booleanNOYES1
SwallowTitle If entry is swallowed onto the panel, this should be the title of the window. localestringNONO1
SwallowExec Program to exec if swallowed app is clicked. stringNONO1
Actions Additional actions possible, see MIME type discussion in the section called “Registering MIME Types”. string(s)NOYES1
MimeType The MIME type(s) supported by this entry. strings(s)NONO1
SortOrder This may specify the order in which to display files. string(s)NONO4
Dev The device to mount. stringNONO3
FSType The type of file system to try to mount. stringNONO3
MountPoint The mount point of the device in question. stringNONO3
ReadOnly Specifies whether or not the device is read only. booleanNONO3
UnmountIcon Icon to display when device is not mounted. Mounted devices display icon from the Icon key. UnmountIcons may be localized with the UnmountIcon[xx]= syntax. stringNONO3
URL If entry is Link type, the URL to access. stringNOYES2
Categories Categories in which the entry should be shown in a menu (for possible values see the Desktop Menu Specification). string(s)NONO1
OnlyShowIn, NotShowIn A list of strings identifying the environments that should display/not display a given desktop entry. Only one of these keys, either OnlyShowIn or NotShowIn, may appear in a group (for possible values see the Desktop Menu Specification). string(s)NONO1-4
StartupNotify If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_LAUNCH_ID environment variable set (see the Startup Notification Protocol Specification for more details). booleanNONO1
StartupWMClass If true, it is KNOWN that the application will map at least one window with the given string as its WM class or WM name hint (see the Startup Notification Protocol Specification for more details). stringNONO1