Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

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 run, an icon, and so on. It 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. If $XDG_DATA_DIRS[2] is not set, then the default path is /usr/share is used. This also implies that user specific desktop entries may be located at $XDG_DATA_HOME/applications which is searched first. If $XDG_DATA_HOME is not set, then the default path ~/.local/share is used. Desktop entries are collected from all directories in the $XDG_DATA_DIRS environment variable. Directories which appear first in $XDG_CONFIG_DIRS are given precedence when there are several .desktop files with the same name.

The following is a sample desktop entry file:

[Desktop Entry]
Encoding=UTF-8
Name=Calculator
Name[fr]=Calculatrice
...
Comment=Perform calculations
Comment[fr]=Effectue des calculs compliqués
...
Exec=gcalctool
Icon=gnome-calculator
Terminal=false
Type=Application
StartupNotify=true
Categories=GTK;GNOME;Application;Utility;

Table 2.2, “Desktop Entry Keys” describes the most important keys in desktop entry files. To get more information about desktop entry files, see the XDG Desktop Entry Specification.

Table 2.2. Desktop Entry Keys

Desktop Entry Key

Description

Categories

Specifies the keywords that describe the item. The keywords are separated with semicolons (;). To see a list of the standard category keywords, see the desktop menu specification at https://www.freedesktop.org/Standards/menu-spec

Menu Definition Files map desktop entries to menus by using matching rules against the Categories key.

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

This options means “This application exists, but don't display it in the menus”.

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 create a window in which to run, the value of this key must be true.

Type

Specifies the type of item. This value is one of the following:

  • Application: An item that starts an application.

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

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

  • Directory: An item that is a Directory.

For more information on the keys in desktop entry files, see the desktop entry specification at the following URL:

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.


Previous
Menu Definition Files
GNOME 2.14 Desktop System Administration Guide Next
Directory Entry Files

 
 
  Published under the terms of the GNU General Public License Design by Interspire