Requirements
In order to use Gajim's DBus capabilities you must have D-Bus installed on it. If you already have D-Bus 0.23.x or higher installed, else read InstallingDBus.
In order to use cool notifications you need to have notification-daemon installed and running. Chances are that if you use latest GNOME-friendly distribution you do
NOTE: Before continue reading this document, makes sure that you meet the requirements and that it still does not work for you.
Setting D-Bus session daemon
If you have somehow latest versions of Ubuntu or Gentoo, you can skip this section. D-Bus works with two very different types of daemons: system and session. The first is for all kinds of global messages to and from all users (eg. HAL daemon uses it to report new hardware). However you need the session, which is available only for the current DESKTOP user. On some GNU systems it is not started by default, so you have to turn this on.
You can see whether you have D-Bus session set by checking your global env variable $DBUS_SESSION_BUS_ADDRESS, so type the following:
test -n "${DBUS_SESSION_BUS_ADDRESS}" && echo "Yes, Dbus session is present" || echo "No"
If it states "Yes" you can move on to the next section.
At this point, you're going to need to know how you have X set up. That is, whether you're using .xinitrc, .Xclients, .xsession add this:
dbuslaunch="`which dbus-launch 2>/dev/null`" if [ -n "$dbuslaunch" ] && [ -x "$dbuslaunch" ] && [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then eval `$dbuslaunch --sh-syntax --exit-with-session` fi
Setting Notification Daemon
You may need this for having cool notifications about events in Gajim.
At this point, you're going to need to know how you have X set up. That is, whether you're using .xinitrc, .Xclients, .xsession add this:
/usr/libexec/notification-daemon &
and restart the X server. (NOTE: your path may vary)
Making use of D-Bus in Gajim
Now that you finished with setting D-Bus session and (if you are not tired yet) you can play with Gajim.
Gajim package comes with a command, called gajim-remote with which you can execute remote actions.
gajim-remote toggle_roster_appearance
this will show/hide your roster
gajim-remote show_next_unread
and if you have unread message, a chat dialog containg one of the awaiting messages will popup
Lots of other things are of course possible:
- See GajimAndMpd for an example of integrating a music player into gajim using gajim-remote
- See GajimStatus plugin of Quod Libet
Using D-Bus notifications
Here's an example python script to monitor dbus and do something when notified via dbus by gajim. script
This script talks to the water plugin from beryl and creates a catchy water ripple notification on incoming messages: gajim2beryl.py . You can see the script in action in this little demo screencast hosted on youtube.
Disabling D-Bus-related capabilities of Gajim
You can turn off the ability to remote control Gajim. The setting you want is remote_control.
You can turn off the ability to use notification daemon (if there) cool notification popups. The setting you want is use_notif_daemon.
You can do this by setting you want to False in Preferences Window, Advanced Tab, Open Advanced Editor. DBUS & KDE KDE 3.4.3 doesn't appear to start a Dbus instance for the user by default. Adding the .bashrc lines from above to a ~/.kde/env/dbus.sh seems to the trick. This is under Gentoo, with /etc/init.d/dbus running.
Attachments
- monitor_dbus.py (0.6 kB) - added by francois on 05/15/06 00:26:34.
- monitor_dbus.2.py (1.5 kB) -
This python script will monitor dbus and do various useful things on gajim events
, added by bluegraydragon@gmail.com on 09/04/06 16:08:50. - gajim2beryl.py (2.5 kB) -
Python dbus script to glue gajim and beryl together
, added by jan@uos.de on 02/28/07 23:54:10.
