KDE System Administration/Startup
Startkde Script
The KDE startup sequence starts with the startkde script. In most cases this script gets called from the display manager (KDM) once the user has been authenticated. There are two very important lines in the startkde script:
LD_BIND_NOW=true kdeinit +kcminit +knotify
and
kwrapper ksmserver $KDEWM
The first line starts the kdeinit master process. This process is used to start all other KDE processes. The arguments behind kdeinit are the names of additional services to be started. The + indicates that kdeinit needs to wait till the service has finished.
The second line asks kdeinit to start the ksmserver session manager process. The session manager determines the lifetime of the session. When this process exits, the user is logged out.
Background Services
All KDE background services are user specific; unlike system daemons they are not shared between users. They are also unique per X-server display.
kdeinit: Kicking Everything Off
kdeinit is used to start all other KDE programs. kdeinit can start normal binary program files as well as kdeinit loadable modules (KLMs). KLMs work just like binary program files but can be started more efficiently. The drawback is that programs started this way appear as kdeinit in the output of top and ps. Use top -c or ps aux to see the actual program name. For example:
> ps aux waba 23184 0.2 2.1 23428 11124 ? S 21:41 0:00 kdeinit: Running... waba 23187 0.1 2.1 23200 11124 ? S 21:41 0:00 kdeinit: dcopserver --nosid waba 23189 0.2 2.4 25136 12496 ? S 21:41 0:00 kdeinit: klauncher waba 23192 0.7 2.8 25596 14772 ? S 21:41 0:00 kdeinit: kded waba 23203 0.8 3.4 31516 17892 ? S 21:41 0:00 kdeinit: knotify
kdeinit: Running... indicates the master kdeinit process. The other processes listed are programs started as KLMs.
When kdeinit starts for the first time it will launch klauncher and kded, as well as any additional programs specified on its command line in the startkde script. Normally that is kcminit and knotify.
dbus-daemon: Inter-process Communication
dbus-daemon provides inter-process communication (IPC) facilities to all KDE applications as well as several other system components, such as HAL, network manager, power manager and various non-KDE desktop applications. It is a cross-desktop, portable IPC project which is hosted at freedesktop.org.
D-Bus facilities are accessible from the command shell via the qdcop command-line tool and can be explored using the graphical dcop-viewer application. D-Bus is essential for all KDE applications and should autostart when requested.
klauncher: Service Activation
klauncher is a daemon which is responsible for service activation within KDE. It operates in close connection with the kdeinit master process to start new processes. KDE applications communicate with klauncher over the D-Bus in order to start new applications or services.
kded: Background Services
kded is a generic KDE daemon. It has the ability to load various service modules and run these in the background. Each kded service module is described by a .desktop file installed under $KDEDIR/share/services/kded/ The Service Manager in the Control Center can be used to monitor the status of the service modules and to disable certain services.
kcminit: Initialization Services
kcminit executes initialization services during startup. Initialization services are specified in the .desktop files of applications or services via the X-KDE-Init line. Initialization services are typically used for initializing hardware based on user-specified settings.
kcminit --list can be used to show all initialization services and kcminit <service> can be used to execute a single service explicitly. This can be useful when investigating start-up problems.
knotify: Notification Services
The primary task of knotify is to relay notifications to appropriate sub-systems. For instance, sound alerts are sent to the sound system, visual alerts are showed on-screen using passive popups or dialogs, logged messages are written out to disk, etc. The actions are user configurable and support user interaction.
ksmserver: Session Management and Autostart
When the fd.o autostart spec is finalized and implemented in KDE4, update this section
ksmserver is KDE's session manager. On startup the session manager starts auto-start applications and it restores applications from the previous session.
The applications to auto-start are indicated by .desktop files in the $KDEDIR/share/autostart directory. Auto-start of an application can be made conditional upon the X-KDE-autostart-condition entry in the .desktop file. The ktip.desktop file, for instance, might contain
X-KDE-autostart-condition=ktiprc:TipOfDay:RunOnStart:true
This means that the ktiprc configuration file is checked for a RunOnStart entry in the [TipOfDay] section. If no such entry is found, true is assumed, which means that ktip is one of the applications that is auto-started by default.
This may change in KDE4. Check back closer to release.
There is an additional auto-start directory, $KDEHOME/Autostart that is sourced later. Note that this autostart path differs from the $KDEDIR/share/autostart directory used by the session manager. While $KDEDIR/share/autostart must contain .desktop files, $KDEHOME/Autostart may contain all kinds of files. The files will be opened as if they were clicked upon by the user.
The KDE session manager also restores one of the previous sessions. A session contains of a collection of applications as well as application-specific information that reflects the state of the applications at the time the session was saved. Sessions are stored in the ksmserverrc configuration file and contains references to application-specific state information. The application specific state infomation is saved in $KDEHOME/share/config/session.
For example, if ksmserverrc contains:
restartCommand1=kwin,-session,110a0a0002000106760689100000019360000_1083342151_608625
restartCommand2=konsole,-session,10378ac070000108334204700000277690000_1083342151_552722
Then the application specific state information for kwin and konsole can be found in
$KDEHOME/share/config/session/kwin_110a0a0002000106760689100000019360000_1083342151_608625
and
$KDEHOME/share/config/session/konsole_10378ac070000108334204700000277690000_1083342151_552722
respectively.
The state information of kwin contains the location of the application windows of all the other applications in the session.
Desktop Components
The three major components of the desktop are the window manager, command executer and workspace (desktop and panels).
kwin: Window Manager
The window manager is always started by the session manager as part of the session restoration. The window manager is responsible for managing all the windows across the virtual desktops, including initial placement, minimizing, maximizing, raising, lowering of the windows and focus-switching between windows.
By default, KWin is started as the window manager in a KDE session. This can be overriden by defining the KDEWM environment variable to be name of an alternate window manager.
krunner: Run Dialog, Task List, Screensaver
krunner is auto-started by the session manager by means of $KDEDIR/share/autostart/krunner.desktop. It is responsible for activating the screensaver, application start feedback, the Run Command (Alt-F2) dialog, and the task list window and is meant to run for the lifetime of the session.
Plasma
when plasma enters the start up sequence document it here.
KDesktop is auto-started by the session manager by means of $KDEDIR/share/autostart/plasma.desktop