Desktop files are a FreeDesktop standard.
There are currently three types: Application
, Link
, and Directory
.
This specification defines 3 types of desktop entries: Application
(type
1), Link
(type 2) and Directory
(type 3). To allow the addition of new
types in the future, implementations should ignore desktop entries with an
unknown type.
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
Application-type desktop files
This is an example Application-type desktop file:
[Desktop Entry]
Name=Calculator
Comment=Perform arithmetic, scientific or financial calculations
Keywords=calculation;arithmetic;scientific;financial;
Exec=gnome-calculator
Icon=gnome-calculator
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;Calculator;
When you do a search for "calculator" in a menu,
the name matches, so it shows this result and icon.
When you click on it, it runs the gnome-calculator
application.
There are more examples of this kind of desktop file in /usr/share/applications/
.
Directory-type desktop files
This is an example Directory-type desktop file
from /usr/share/desktop-directories/Utility.directory
:
[Desktop Entry]
Name=Accessories
Comment=Desktop accessories
Icon=applications-utilities
Type=Directory
X-Ubuntu-Gettext-Domain=gnome-menus-3.0
This means that there will be an "Accessories" entry in a hierarchical menu,
and because e.g. the calculator example above
has Utility
in the Categories
field,
the calculator will show up as a sub-entry of "Accessories".
The FreeDesktop spec also mentions
that these can include localized names in other languages:
Directory entry
A directory entry is a file with a name ending in the ".directory" extension
which conforms to the desktop entry
specification with
Type=Directory
. It provides a localized name and an icon for a submenu.
Directory entries are also known as ".directory files."
https://specifications.freedesktop.org/menu-spec/latest/go01.html
for example:
[Desktop Entry]
Type=Directory
Verson=1.0
Name=Electronics
Name[ca]=Electrònica
Name[cs]=Elektronika
Name[de]=Elektronik
Name[el]=Ηλεκτρονικά
Name[es]=Electrónica
Name[eu]=Elektronika
Name[fi]=Elektroniikka
Name[fr]=Electronique
Name[hu]=Elektronika
Name[it]=Elettronica
Name[ja]=電子工学
Name[nb_NO]=Elektronikk
Name[nl]=Electro
Name[pl]=Elektronika
Name[pt_BR]=Eletrônica
Name[pt_PT]=Eletrónica
Name[ro]=Electronică
Name[ru]=Электроника
Name[sv]=Elektronik
Name[tr]=Elektronik
Name[zh_CN]=电子
Name[zh_TW]=電子學
Icon=applications-electronics
(Hierarchical menus for listing applications
aren't supported
by the GNOME 3 desktop anymore,
but other desktops like
XFCE4,
KDE Plasma,
and LXDE still have them.)
There are more examples here:
/usr/share/desktop-directories/
Link-type desktop files
This is an example Link-type desktop file:
[Desktop Entry]
Type=Link
Name=Examples
Comment=Example content for Ubuntu
URL=file:///usr/share/example-content/
Icon=folder
This is a simplified version of the desktop file
provided from the example-content
package.
When you click this in a file manager,
it navigates to this directory:
/usr/share/example-content/
In this case the URL
field is a file://
URL,
but it could be any other kind of URL,
such as an https://
URL:
[Desktop Entry]
Name=AskUbuntu.com
Type=Link
URL=https://askubuntu.com/
Icon=text-html
or a mailto:
URL:
[Desktop Entry]
Name=Email someone
Type=Link
URL=mailto:example@ubuntu.com
or an smb://
URL:
[Desktop Entry]
Name=My Samba share
Type=Link
URL=smb://username@server/my-samba-share
or a special file-manager URL like this:
[Desktop Entry]
Name=Trash
Type=Link
Icon=user-trash-full
EmptyIcon=user-trash
URL=trash:///
or this:
[Desktop Entry]
Name=Recent documents
Type=Link
Icon=document-open-recent
URL=recent:///
Related:
.desktop
files are Progam Launchers – blade19899 Oct 19 '15 at 09:22ls Desktop
and if possible a desktop screenshot! It would be nice to see if there is an issue and something odd downloaded. – Tim Oct 19 '15 at 13:31.desktop
format shortcut on your Desktop, to that picture's original URL online. – underscore_d Oct 19 '15 at 16:32/usr
and if not then it doesn't matter - you've not uninstalled anything. – Tim Oct 19 '15 at 17:01.lnk
. – user530873 Oct 19 '15 at 17:33