Dbus session bus address with applications using SSH

Posted in apps , Linux
If you have only one host connecting and launching dbus sessions, this will work:
$ export `grep ^DBUS_SESSION_BUS_ADDRESS \
$HOME/.dbus/session-bus/$(dbus-uuidgen --get)-$(echo $DISPLAY \
| sed -e 's/\([^:]*:\)//g' -e 's/\..*$//g')`
From: http://machine-cycle.blogspot.com/2010/12/ssh-and-dbus-sessions.html

dbus-bus-signYou can also get the variable from running sessions in /proc/ /environ. But as soon as you have multiple hosts, you need to figure out which host you’re coming from. That would be fine, except that you’re not guaranteed to have sessions already running, especially when you’re running headless and exporting the display! And try removing .dbus/session-bus in your home directory, what then?

dbus-launch

$ dbus-launch --sh-syntax \
| grep DBUS_SESSION_BUS_ADDRESS > /tmp/dbus-session-bus-address
Depending on your application, you can use dbus-launch in a user’s profile or system wide in rc.local and share the same session bus for all your apps.
$ export `cat /tmp/dbus-session-bus-address`

If you don’t need interprocess communication, you can spawn a session each time, but don’t forget to include the exit-with-session option to your dbus-launch otherwise you’ll end up spawning a new session each time that never dies.

The strangest behavior i’ve seen is shell’s missing every other character after launching a second dbus-launch. In the shell, I could type 1234567890 and only the characters 24680 would show up. It wasn’t just a local display problem, because by double typing each key, I could still navigate and execute commands.

Posted by admica   @   26 February 2011

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

*

Previous Post
«
Next Post
»
Powered by Wordpress   |   Lunated designed by ZenVerse

Valid XHTML 1.0 Transitional