Oracle® Solaris 11.2 Desktop Administrator's Guide

Exit Print View

Updated: July 2014
 
 

Working With Desktop Entry Files

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:

  1. 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.

  2. 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 fil e.

[Desktop Entry]
Encoding=UTF-8
Name=Calculator
Name[fr]=Calculatrice
...
Comment=Perform calculations
Comment[fr]=Effectue des calculs compliq

ue
...
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.

Table 3-3  Desktop Entry Keys
Desktop Entry Key
Description
Categories
Specifies the keywords that describe the item. The keywords are separated with semicolons (;).
For a list of the standard category keywords, see the desktop menu specification at http://www.freedesktop.org/Standards/menu-spec.
To find out how to map desktop entries to menus by using matching rules with the Categories key, see Working With Menu Definition Files.
Comment
Specifies a short description of the item. The comment is displayed as a tooltip when you point to the item in the menu.
Encoding
Specifies the encoding of the desktop entry file.
Exec
Specifies a command to execute when you choose the item from the menu.
Icon
Specifies the filename of an icon that represents the item. Does not specify the path to the filename or the file extension.
MimeType
Specifies the MIME types that the application can handle.
Name
Specifies the name of the item. This name is displayed on the item in the menu.
NoDisplay
Specifies that an existing application should not be displayed in the menu.
Terminal
Specifies whether the command in the Exec key runs in a terminal window. If the value is true , the command runs in a terminal window.
If the command does not open a window to run, the value of this key must be set to true.
Type
Specifies the type of item. The value for the Type key is one of the following:
  • Application: An item that starts an application.

  • Link: An item that links to a file or folder, or a remote resource (such as a n FTP site, or a web page).

  • FSDevice: An item that is a file system device.

  • Directory: An item that is a directory.

For more information about the keys in desktop entry files, see the desktop entry specification.


Note - Panel launchers and desktop objects also use desktop entry files. The desktop entry files for launchers and desktop objects provide the same information as for items in a menu. For example, the desktop entry files provide the command to run when a user chooses the launcher or object.