A .desktop
file is basically a simple text file holding information about a program.
It represents and application that is identified by the name of the desktop file.
When a MyApp.desktop
file is created, Ubuntu launcher shows a new icon linked to (and named as) MyApp.
Such a file are also useful to run a software with a double-click on its icon.
Desktop files implements the Exec
entry which is the path of the executable.
Executables could be binaries, script or even a command sent to the comman line.
For binaries and scripts, the path must be absolute and cannot be set relative to the desktop file location.
It could happen the exec command does not work as expected.
For example, the app crashes if not run in a terminal.
In such cases we have three options:
-
run app in terminal
Exec=gnome-terminal -- /path/to/executable
This is particularly usefull when an application (eg. Blender, Matlab) prints its log messages on the standard output/error on the console. -
add semicolon (still dunno why, but ehi... it works)
Exec=/path/to/executable;
-
exec a script that runs "disown" command
Exec=/path/to/script/run.sh
where run.sh is something like:
#!/bin/bash
/path/to/executable &
disown %1
It is usually placed in ~/.local/share/applications
or /usr/share/applications/
depending whether you want the launcher to be accessible only for local account or for everyone.