Sending dbus events to a session bus as another user

Carl van Tonder simplyw00x at gmail.com
Sun Apr 8 15:24:31 PDT 2007


Dear List,
I've recently decided that simply using Evolution to read my POP3 email wasn't nearly difficult, portable or nerdy enough, so after much heart-ache I've switched to fetchmail, procmail, mutt and msmtp (with dovecot serving the output as a locally-accessible IMAP so I can still read email in Evolution). 
This is all peachy and irrelevant, the problem, however, is that I'd like to use d-bus's fine notification mechanism (notification-daemon and libnotify etc.) to tell me when I have new email. For me, superfluous daemon process are anathema, and I'd quite like to be informed of e-mail as it arrives, rather than in tasty batches as many current scripts would like me to do. 
My .procmailrc line looks like this:
	| formail -fc -x Subject |  sed -e 's/carl.*2007  //' | sed -e
	's/<.*>//' | sed -e 's/^/\"/g' | sed -e 's/$/\"/g' | xargs -t sudo -u
	carl notify-send -i stock_mail "New Mail" 

The problem, predictably, is that whichever user procmail is running as (plainly not me), it doesn't have access to my d-bus session: 
libnotify-Message: Unable to get session bus: Failed to execute dbus-launch to autolaunch D-Bus session

The interesting thing is that I've tried (as you can see in the example) using `sudo -u carl` to run notify-send as my user (which interestingly works in a root shell, but not here), and tried exporting $DBUS_SESSION_BUS_ADDRESS to the value it has during my own session, but that doesn't even work in a root shell (http://gnome-hacks.web.com/hacks.html?id=82 claims that it should).

So, gods of d-bus, can you help me in my trivial (but immensely
frustrating) plight?

-- 
Carl van Tonder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070408/330e9af6/attachment.pgp


More information about the dbus mailing list