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
- Check for updates with your package manager
Where to put the desktop file?
The FreeDesktop standards for base directories specify the
~/.config directory for configuration files. For autostart files, this is
Use your favorite editor to open a new file in the autostart folder, called
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:
Execis 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.
Nameis 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.
Commentis just a command on what the program is.
Typeis the type of object represented by this file. Other possible values include "Link" and "Desktop"
Iconis the path to an icon for the entry. Again, this is more useful for a desktop menu entry.
StartupNotifyindicates whether or not we want to be notified when the program launches.
X-GNOME-Autostart-enabledis 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