Sometimes you might want to run commands or start programs each time you login to a graphical session. Some reasons you might want/need to do this:

To do this, you will need to create a desktop file. As an example, we will create a bare-bones desktop file that launches Guake on login.

Where to put the desktop file?

The FreeDesktop standards for base directories specify the ~/.config directory for configuration files. For autostart files, this is ~/.config/autostart.

Use your favorite editor to open a new file in the autostart folder, called start_guake.desktop:

emacs ~/.config/autostart/start_guake.desktop


Do NOT give the desktop file the same name as the executable. Some programs will attempt to modify or remove desktop files with the same name.

Here is a basic desktop file for launching guake (explanation below):

[Desktop Entry]
Comment=Start Guake

The file starts with [Desktop Entry], which indicates to any program looking for desktop files that this file should be evaluated. This example only uses a tiny fraction of the possible keys for a desktop file, but for the keys that are used: