#!/bin/sh user=`whoami` pid=`pgrep -u $user notification-da | cut -d' ' -f 1` # find DBUS session bus for this session DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \ /proc/$pid/environ |sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'` # if it was successfull, then we either print it, # or export it or whatever, if we want if [ "x$DBUS_SESSION_BUS_ADDRESS" != "x" ]; then export DBUS_SESSION_BUS_ADDRESS # and we start using rhythmbox-client rhythmbox-client --no-start --print-playing-format "%aa: %tt" fi