Desktop files

Desktop icons are defined in the *.desktop files found in ~/Desktop . Some file manager want to be clever and smart and do not show the filenames but interpret their contents found inside those *.desktop text files a link to an icon and a name to be shown.

The easiest way to get such files is going to the menu and right click the mouse and select put to desktop. However going to /usr/share/applications and see what desktop files are already available and then just copy them to ~/Desktop. The *.desktop files is an other option. Since the *.desktop files are text files they can be edited using a text editor

There are also tools to create *.desktop files.

Path to the executable, Name on the desktop and finally an icon has to be placed. Icons for that can be found under /usr/share/icons or /usr/share/pixmaps for those directories not path and file extension must be added. For Icons in other directories the path must be present.

Important

Desktop files should be validated using the desktop-file-validate tool.

Finally right click on the mouse lets to move menu icons to the desktop.

Note

However also documents and links to documents can be placed can be placed in the Desktop directory and appear as icons on the screen.

If a executable is not found add the path and use " characters

Exec="/opt/serna-free-4.4/bin/serna.sh"

The menu is made from *.desktop files in ~/.local/share/applications for user menus and /usr/share/applications for global menus. The parameter

Categories=Game

inside those files defines the category where they pop up. There is the java application lxmed that is a gui for this.

To have the terminal running:

Terminal=true

Inside the directory /usr/share/applications also a file mimeinfo.cache can be found. Having a file of a mime type, then the desktop file handling this type of data can be found. This cache file is created from the *.desktop files using their mime type declaration:

MimeType=video/dv;video/mpeg;video/x-mpeg;

File managers as pcmanfm make use of desktop files in /usr/share/applications that, when clicking on a file the mime type is defined (looking at the file extension) and via mimeinfo.cache the *.desktop file is found and therefore started including passing the name of the file being clicked.

Note

It takes the desktop files from /usr/share/applications and not from ~/Desktop

In pcmanfm go to Edit/Preferences/General, Check box for "Don't ask options on launch executable file" to not have questions popping up

Desktop files can also be started automatically when they are put in /etc/xdg/autostart

Inside the *.desktop files there is the command including an variable as %f that represents a single file name.

Note

AdobeReader.desktop has %U inside indication that is an URL but pcmanfm passes a file and then acroread does not open the file. Changing %U to %f fixes this issue.

Note

Some applications do not have icons and take icons form a icon theme. So install theme as:

adwaita-icon-theme

faenza-icon-theme

lxde-icon-theme

tango-icon-theme

oxygen-icons

mate-icon-theme

elementary-xfce-icon-theme

xdg-open <filename> opens a file with the default application

xdg-settings get default-web-browser returns the desktop file of the default browser

gtk-launch <name of desktop file without .desktop> start such files


Linurs startpage