Documentation

Suggested implementation on Unix type systems

To make the most portable, per-user daemon startup possible, use the X or Xorg Xsession or xinit mechanism. Because PulseAudio depends on a running console kit session, PulseAudio Daemon must be started after the call to ck-xinit-session. If care is taken to order the scripts properly, xinitrc.d could contain one script which starts console kit and another which starts PulseAudio Daemon. Otherwise, insert the PulseAudio startup line in the Xsession startup script before the desktop environment is started.

Using this mechanism will ensure that no matter what window manager or desktop environment gets started, pulseaudio daemon will get started running as the logged in user. Individual desktop environments can then determine best how to hook into the PulseAudio Daemon, be it through the ESD replacement, through the ALSA layer, or via direct library support (e.g. Xine).

Xsession specific modules should be loaded using the same mechanism.

Existing Alternatives

Gnome

Gnome runs PulseAudio Daemon as part of the gnome session startup, but is the only desktop environment that has native support for starting the daemon. All other desktop environments implement session startup differently.

KDE3

For KDE3, special care must be taken so that pulseaudio starts both after the console kit session, and before artsd starts. Otherwise an error message pops up in KDE3:

Sound server informational message:
Error while initializing the sound driver:
device: default can't be opened for playback (Connection refused)
The sound server will continue, using the null output device.

KDE 4.x

In KDE4, Fedora 9 uses an env script to start PulseAudio Daemon as part of the KDE environment.

OpenBox

In ?OpenBox on Foresight Linux, a .desktop file is dropped into /etc/xdg/autostart to start the daemon. This solution required adding support for the xdg autostart mechanism in ?OpenBox.

Loading X specific modules

It appears that several Linux distros are using a .desktop file in /etc/xdg/autostart to load module-x11-xsmp. This is problematic as not all Desktop Environments support the xdg standard.