Autostarting Applications and Run-Once Applications

Chapter 4. Autostarting Applications and Run-Once Applications

You can run applications upon every KDE start, or you can run e.g. a script once.

Automatically Running an Application on KDE Start

By placing a .desktop file under share/autostart (either under $KDEHOME or under $KDEDIR) the application described by this desktop file will be automatically started when KDE starts. There are some extra fields that you can define to control when exactly the application should be started. There is also a possibility to make the start of the application conditional.

X-KDE-autostart-phase=1

This field describes the phase in which the application should be started. There are currently two phases defined:

1

Before applications that are part of the session are restored by the session manager.

2

After applications that are part of the session are restored by the session manager.

The default is 1. If an application is auto-started but can also be part of the session, you typically want to have it in phase 2, that way the application that gets auto-started can detect that it has already been restored by the session manager and exit.

X-KDE-autostart-condition=kalarmdrc:General:Autostart:true

This field makes the auto-start of the application condtional. In this example the application is only started if the config file kalarmdrc has the key Autostart in the General group set to true. The value true at the end of the line is used as default value if the key or config file is not present.

X-KDE-autostart-after=panel

This field can be used to control when an application should be autostarted. It refers to the name of another desktop-file in the autostart directory. In this example the application will be started after the panel (Kicker) has been started. This is usefull for such things as applications that dock into the panel.

See also kdelibs/kinit/README.autostart

KDE Logo