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.
Some keys only make sense in the context when another particular key
is also present and set to a specific value. Those keys should not be
used if the particular key is not present or not set to the specific
value. For example, the Terminal
key can only be used
when the value of the Type
key is
Application
.
If a REQUIRED key is only valid in the context of another key set to a
specific value, then it has to be present only if the other key is set to
the specific value. For example, the URL
key has to be
present when and only when when the value of the Type
key is Link
.
Some example keys: Name[C]
, Comment[it]
.
Table 2. Standard Keys
Key | Description | Value Type | REQ? | Type |
---|---|---|---|---|
Type |
This specification defines 3 types of desktop entries:
Application (type 1),
Link (type 2)
and Directory (type 3).
To allow the addition of new types in the future,
implementations should ignore desktop entries with an
unknown type.
| string | YES | |
Version |
Version of the Desktop Entry Specification that the
desktop entry conforms with. Entries that confirm with this
version of the specification should use 1.5 .
Note that the version field is not required to be present.
| string | NO | 1-3 |
Name | Specific name of the application, for example "Mozilla". | localestring | YES | 1-3 |
GenericName | Generic name of the application, for example "Web Browser". | localestring | NO | 1-3 |
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).
| boolean | NO | 1-3 |
Comment |
Tooltip for the entry, for example "View sites on the
Internet". The value should not be redundant with the values of
Name and GenericName .
| localestring | NO | 1-3 |
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, the algorithm described in the Icon Theme Specification will be used to locate the icon. | iconstring | NO | 1-3 |
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.
| boolean | NO | 1-3 |
OnlyShowIn , NotShowIn |
A list of strings identifying the desktop environments that should display/not display a given desktop entry. By default, a desktop file should be shown, unless an OnlyShowIn key is present, in which case, the default is for the file not to be shown.
If
The same desktop name may not appear in both
| string(s) | NO | 1-3 |
DBusActivatable |
A boolean value specifying if D-Bus activation is supported for this application. If this key is
missing, the default value is false . If the value is true
then implementations should ignore the Exec key and send a D-Bus message to
launch the application. See D-Bus Activation for more information on
how this works. Applications should still include Exec= lines in their desktop files for
compatibility with implementations that do not understand the DBusActivatable key.
| boolean | NO | |
TryExec | Path to an executable file on disk used to determine if the program is actually installed. If the path is not an absolute path, the file is looked up in the $PATH environment variable. If the file is not present or if it is not executable, the entry may be ignored (not be used in menus, for example). | string | NO | 1 |
Exec |
Program to execute, possibly with arguments. See the
Exec key for details on how this key
works. The Exec key is required if DBusActivatable is not
set to true . Even if DBusActivatable is
true , Exec should be specified for compatibility with
implementations that do not understand DBusActivatable .
| string | NO | 1 |
Path |
If entry is of type Application , the working directory to run the program in.
| string | NO | 1 |
Terminal | Whether the program runs in a terminal window. | boolean | NO | 1 |
Actions | Identifiers for application actions. This can be used to tell the application to make a specific action, different from the default behavior. The Application actions section describes how actions work. | string(s) | NO | 1 |
MimeType | The MIME type(s) supported by this application. | string(s) | NO | 1 |
Categories | Categories in which the entry should be shown in a menu (for possible values see the Desktop Menu Specification). | string(s) | NO | 1 |
Implements | A list of interfaces that this application implements. By default, a desktop file implements no interfaces. See Interfaces for more information on how this works. | string(s) | NO | |
Keywords |
A list of strings which may be used in addition to other
metadata to describe this entry. This can be useful e.g. to
facilitate searching through entries. The values are not meant
for display, and should not be redundant with the values of
Name or GenericName .
| localestring(s) | NO | 1 |
StartupNotify | If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_STARTUP_ID environment variable set. If false, it is KNOWN that the application does not work with startup notification at all (does not shown any window, breaks even when using StartupWMClass, etc.). If absent, a reasonable handling is up to implementations (assuming false, using StartupWMClass, etc.). (See the Startup Notification Protocol Specification for more details). | boolean | NO | 1 |
StartupWMClass | If specified, 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). | string | NO | 1 |
URL | If entry is Link type, the URL to access. | string | YES | 2 |
PrefersNonDefaultGPU | If true, the application prefers to be run on a more powerful discrete GPU if available, which we describe as “a GPU other than the default one” in this spec to avoid the need to define what a discrete GPU is and in which cases it might be considered more powerful than the default GPU. This key is only a hint and support might not be present depending on the implementation. | boolean | NO | 1 |