A .desktop file is a launcher. When run, it executes a command, which usually launches an application. Use this tag if you are asking a question about using a .desktop file or about the .desktop file format in general.
.desktop file (MIME type:
application/x-desktop) is a text file (editable in virtually any text editor like emacs, gedit or vim, for example) that is used to create program launchers on systems running the X Windowing System. More formally, a
.desktop file is a configuration file standardized in the Desktop Entry Specification. 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:
It has the following basic structure:
[Desktop Entry] Key1=Value1 Key2=Value2 Key3=Value3 . . . (and so on)
Value(i) can be one of a fixed set described here.
This is an optional field that refers to what type of application the launcher is. Like an educational application (e.g., avogadro, openbabel, octave, etc.) would have the category
Education. Each category is separated by a semicolon (
This is an optional field that is like a short description of the program the desktop file launches.
This is what the launcher runs through bash. For example,
Exec=scilabwould run scilab, if it is installed. This field is mandatory if
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, gedit may have
GenericName=Text editor, likewise emacs might have the same
GenericNamevalue, that is,
Text editor. This key is optional.
This is the icon given to the launcher. Desktop configuration files by default take their icons from
~/.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,
.xpm. This field is optional; if it is omitted an icon like that below will be used in its place.
This is an optional field that serves as metadata for the desktop entry.
This is an optional field that is used to determine which files it will appear in the "Open With" context-menu for. For example, if
MimeType=text/plainthen if this desktop file is saved in the
~/.local/share/applicationsdirectories it will appear in the open with menu for all plain text files (e.g., those with the file extension
This is the name with which the icon is displayed (e.g., if
Name=geditthen 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 Colorsthat is the Name that appears for the launcher when you are using US English, and another line
Name[en_AU]=GNOME Coloursfor if you are using Australian English. This key is mandatory.
This field can be either
Noand refers to whether or not the program is to be run in the terminal. It is optional and its default value is
This is a mandatory field that can only take on three values
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.