Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
What is the syntax for .desktop files?
How do I add a custom launcher?

I prefer to create new desktop launchers (.desktop files) using just a text editor, for example to create an iotop launcher I write:

[Desktop Entry]
Name=iotop
Exec=gksudo "gnome-terminal -x iotop"
Type=Application

But I haven't found any documentation on the format. Can someone give me a link to the format specification?

share|improve this question

marked as duplicate by Jorge Castro, hhlp, Tom Brossman, Ringtail, Luis Dec 26 '12 at 21:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

up vote 7 down vote accepted

The .desktop file specification is here: http://standards.freedesktop.org/desktop-entry-spec/latest/

An example .desktop file would be:

[Desktop Entry]
Version=1.0
Type=Application
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview
MimeType=image/x-foo;
NotShowIn=KDE;

A .desktop file can have translations integrated, by specifying the language:

Name=Foo Viewer
Name[en_GB]=Foo Viewer
Name[el_GR]=Φου Βιούερ

If you want to add unity submenus to unity panel icon, then you can create a desktop file. An example from http://maketecheasier.com/8-really-useful-ubuntu-unity-quicklists/2011/05/07

First copy the original .desktop file and open it with your favourite text editor:

cp /usr/share/applications/firefox.desktop ~/.local/share/applications
gedit ~/.local/share/applications/firefox.desktop

Then edit the file:

[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
GenericName=Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;
StartupWMClass=Firefox
StartupNotify=true
X-Ayatana-Desktop-Shortcuts=NewWindow;Private;Safe;ProfileManager;MakeTechEasier

Name[en_US]=Firefox Web Browser

[NewWindow Shortcut Group]
Name=Open a New Window
Exec=firefox -new-window
TargetEnvironment=Unity

[Private Shortcut Group]
Name=Private Mode
Exec=firefox -private-toggle
TargetEnvironment=Unity

[Safe Shortcut Group]
Name=Safe Mode
Exec=firefox -safe-mode
TargetEnvironment=Unity

[ProfileManager Shortcut Group]
Name=Start Profile Manager
Exec=firefox -ProfileManager
TargetEnvironment=Unity

Now run nautilus ~/.local/share/applications/ and drag-and-drop your newly-created "Firefox" unity desktop file in the unity bar.

share|improve this answer
1  
Please Provide a Description if you can.... not just a link –  Amith KK Dec 25 '11 at 12:42
1  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Marco Ceppi Dec 25 '11 at 12:50
    
I would, but the answer wouldn't fit in one page. The answer is the whole specification. :) I can add and example of a .desktop file –  medigeek Dec 25 '11 at 13:15

The format of .desktop configuration files is a unified standard and described in the FreeDesktop.org Desktop Entry Specification. The files specify how an application is launched, how it appears in menus, and so forth.

The GNOME Dev Center has a good tutorial on creating these files for your own applications.

share|improve this answer

You can find information about .desktop file here: Desktop Entry Specification

share|improve this answer
    
Please, be a little bit more verbose in your answers. –  enzotib Apr 29 '11 at 7:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.