Adding Desktop Entries to System

Desktop entry files provide information about item in menus.

Desktop entry files must reside in the $XDG_DATA_DIRS/applications directory and must have a .desktop file extension. If $XDG_DATA_DIRS is not set, then the default path is /usr/share is used.

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_DATA_DIRS are given precedence when there are several .desktop files with the same name.

So, if you drop a correctly formatted .desktop file in any of the above mentioned locations, a new launcher icon will appear in the menu hierarchy as specified by the keywords in the .desktop file.

The freedesktop.org maintains software base platform and specification for desktop software on Linux and UNIX. To get more information on the latest desktop entry files, see the Desktop Entry Specification at freedesktop.org.

Here’s a sample desktop entry file for Eclipse:

[Desktop Entry]
Version=1.0
Name=Eclipse
GenericName=Eclipse IDE
Comment=Eclipse IDE
Exec=/home/puppychau/bin/eclipse/eclipse %F
Icon=/home/puppychau/bin/eclipse/icon.xpm
Type=Application
Terminal=false
Categories=Development;IDE

One thought on “Adding Desktop Entries to System”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.