# Autostart

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:

• Update your wallpaper with latest image from a photo stream
• Launch a dropdown teminal program

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


Warning

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]
Exec=guake
Name=guake
Comment=Start Guake
Type=Application
Icon=guake
StartupNotify=true
X-GNOME-Autostart-enabled=true


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:

• Exec is the actual executable that the autostart program should launch. This can either be something in your executable path, or the full path to an executable.
• Name is the name of the desktop entry. This might seem unnecesssary, but keep in mind that desktop entries were originally intended to add things to the graphical start menu, so a name would be important.
• Comment is just a command on what the program is.
• Type is the type of object represented by this file. Other possible values include "Link" and "Desktop"
• Icon is the path to an icon for the entry. Again, this is more useful for a desktop menu entry.
• StartupNotify indicates whether or not we want to be notified when the program launches.
• X-GNOME-Autostart-enabled is used by the GNOME autostart program to see if this desktop file is intended for its use. Note that the X-indicates that this is not a standard key, but one used by a particular parser of desktop files. This is similar to the HTTP extension headers, such as X-Forwarded-For.