Search:  
Gentoo Wiki

TIP_D-BUS_Session_Bus_with_KDM

Anyone who has been keeping up with recent advances in X11 desktop technology has probably heard of D-BUS by now, even if only through the auto-mount systems which now rely on the D-BUS system bus. Some people may have started to encounter technology based on the session bus such as libnotify (OSX-like notification support for X11).

However, while enabling the D-BUS system bus on Gentoo is as simple as rc-update add dbus default, enabling the session bus isn't quite so intuitive, especially when using a graphical login manager.

The problem is that all of the documentation most people will find is written either for people who use startx or people who use GNOME. I ended up having to trace through the tangle of init scripts called by KDM in order to find a solution.

Per-user

Note: This approach will not conflict with existing or future system-wide ones.

To enable a D-BUS session bus for a single account, we will take advantage of an optional feature I discovered while digging through the startkde script.

Simply create the following file and give yourself read and execute permissions. (the ~/.kde/env directory probably won't exist. Just create it.)


File: ~/.kde/env/start_dbus_session_bus.sh
 
# test for an existing bus daemon, just to be safe
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
        # if not found, launch a new one
        eval `dbus-launch --sh-syntax --exit-with-session`
fi
  

All you need to do now is log out. The session bus will now start every time you log in, and exit when you log out.

System-wide

Enabling a DBUS session bus for all users is much the same as the per-user instructions above, except the script is created in the KDE global environment directory:

File: /usr/kde/3.5/env/start_dbus_session_bus.sh
 
# test for an existing bus daemon, just to be safe
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
        # if not found, launch a new one
        eval `dbus-launch --sh-syntax --exit-with-session`
fi
  
Note: This change will need to be re-applied whenever KDE is upgraded e.g. to KDE 3.6.
This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other
Retrieved from "http://www.gentoo-wiki.info/TIP_D-BUS_Session_Bus_with_KDM"

Last modified: Fri, 05 Sep 2008 10:01:00 +0000 Hits: 6,999