The session bus is a session specific bus (mostly for desktop use).
Use SessionBus, the non-singleton ASessionBus is for the test suite.
Get the the default session bus.
# File lib/dbus/bus.rb, line 731 def initialize super(ENV["DBUS_SESSION_BUS_ADDRESS"] || address_from_file || "launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET") connect send_hello end
# File lib/dbus/bus.rb, line 737 def address_from_file f = File.new("/var/lib/dbus/machine-id") machine_id = f.readline.chomp f.close display = ENV["DISPLAY"].gsub(/.*:([0-9]*).*/, '\1') File.open(ENV["HOME"] + "/.dbus/session-bus/#{machine_id}-#{display}").each do |line| if line =~ /^DBUS_SESSION_BUS_ADDRESS=(.*)/ return $1 end end rescue Errno::ENOENT nil end