ConsoleKit is a framework for managing user sessions and permissions. Some of the most common usages of consolekit is allowing non-root users to mount removable media and suspending/shutting down the computer through common desktop applications (ie: thunar, nautilus, the gnome shutdown menu, etc).
Display manager usage
exec ck-launch-session startxfce4
Running several applications from ~/.xinitrc
If several applications are to be executed from Template:Filename, not all of these will have consolekit environment variables set. In the following example, only children of compiz will be able to properly use conosolekit, but children of xterm won't.
xterm & exec ck-launch-session compiz ccp
Typically, this can be an issue when for example using compiz standalone and some other application launchers, (gnome-do, kupfer, gmrun, xbindkeys, etc.) since children of the application launcher won't be able to use consolekit. A dirty workaround is to have the entire session started by a second script, e.g. Template:Filename. Don't forget dbus-launch, it's likely you need it too:
Don't forget to make .xstart executable:
chmod +x ~/.xstart
To see whether everything is started right:
It should show at least one session like this one
Session18: unix-user = '1000' realname = 'Your Name' seat = 'Seat1' session-type = active = TRUE x11-display = ':0' x11-display-device = '/dev/tty2' display-device = '/dev/tty1' remote-host-name = is-local = TRUE on-since = '2011-11-16T12:01:50.104764Z' login-session-id = '7'