About

A .desktop file (MIME type: application/x-desktop) is a text file (editable in virtually any text editor like , or , for example) that is used to create program launchers on systems running the X Windowing System. It is usually used as an application launcher, which may appear in a menu, on a desktop, or in search results. Application launchers that appear on the Unity left sidebar all appear in one of two possible places: /usr/share/applications or ~/.local/share/applications.

Structure

It has the following basic structure:

[Desktop Entry]
Key1=Value1
Key2=Value2
Key3=Value3
.   .   . (and so on)

Where Key(i) (where i=1,2,3,...,n) and Value(i) can be one of a fixed set described here.

Common keys

  • Categories

    This is an optional field that refers to what type of application the launcher is. Like an educational application (e.g., , , , etc.) would have the category Education. Each category is separated by a semicolon (;).

  • Comment

    This is an optional field that is like a short description of the program the desktop file launches.

  • Exec

    This is what the launcher runs through bash. For example, Exec=scilab would run , if it is installed. This field is mandatory if Type=Application.

  • GenericName

    This is a more generic name (like a group name for the set of applications to which the application belongs) for the application. For example, may have GenericName=Text editor, likewise might have the same GenericName value, that is, Text editor. This key is optional.

  • Icon

    This is the icon given to the launcher. Desktop configuration files by default take their icons from /usr/share/pixmaps/, /usr/share/icons/ and ~/.local/share/icons/, although if you specify the full path of the icon you want you may use icon files outside these directories. These icons can be in a range of different file formats including, but not limited to, .gif, .jpg, .png, .svg and .xpm. This field is optional; if it is omitted an icon like that below will be used in its place.

    Vivacious-Colors application-blank icon

  • Keywords

    This is an optional field that serves as metadata for the desktop entry.

  • MimeType

    This is an optional field that is used to determine which files it will appear in the "Open With" for. For example, if MimeType=text/plain then if this desktop file is saved in the /usr/share/applications or ~/.local/share/applications directories it will appear in the open with menu for all plain text files (e.g., those with the file extension .txt).

  • Name

    This is the name with which the icon is displayed (e.g., if Name=gedit then your launcher will be called gedit). This field can be specified for different languages too, for example you may have one line Name[en_US]=GNOME Colors that is the Name that appears for the launcher when you are using US English, and another line Name[en_AU]=GNOME Colours for if you are using Australian English. This key is mandatory.

  • Terminal

    This field can be either Yes or No and refers to whether or not the program is to be run in the terminal. It is optional and its default value is No.

  • Type

    This is a mandatory field that can only take on three values Application, Link or Directory. It refers to the nature of the launcher, that is, what it does, like whether it serves as a link to a file or folder, or whether it runs an application.

history | show excerpt | excerpt history