2

Using the following command I can get the list of DBUS services.

dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames

The output is:

method return time=1531507472.618646 sender=org.freedesktop.DBus -> destination=:1.83 serial=3 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "com.canonical.Unity.Launcher"
      string "org.freedesktop.Notifications"
      string ":1.7"
      string "org.freedesktop.network-manager-applet"
      string ":1.8"
      string "com.canonical.indicator.datetime"
      string ":1.9"
      string "org.gnome.Mutter.IdleMonitor"
      string "org.gtk.vfs.mountpoint_2434"
      string "com.canonical.indicator.sound"
      string "org.gtk.vfs.Daemon"
      string "org.pulseaudio.Server"
      string "com.canonical.indicator.application"
      string "com.ubuntu.Upstart"
      string "org.gnome.SessionManager"
      string "com.canonical.hud"
      string "com.canonical.indicator.session"
      string ":1.82"
      string ":1.60"
      string ":1.83"
      string ":1.61"
      string "com.canonical.indicator.messages"
      string "org.gnome.GConf"
      string "org.gnome.evolution.dataserver.Sources5"
      string "org.gnome.Terminal"
      string ":1.63"
      string "org.gtk.vfs.UDisks2VolumeMonitor"
      string "org.a11y.Bus"
      string ":1.64"
      string ":1.42"
      string ":1.20"
      string ":1.65"
      string ":1.43"
      string "org.gnome.SettingsDaemon.Power"
      string ":1.66"
      string ":1.44"
      string "org.gnome.keyring"
      string "org.gnome.Shell"
      string ":1.67"
      string ":1.45"
      string "com.canonical.Unity.WindowStack"
      string ":1.68"
      string ":1.46"
      string ":1.24"
      string "com.canonical.Unity.Panel.Service.Desktop"
      string ":1.69"
      string "org.gnome.DejaDup.Monitor"
      string ":1.48"
      string ":1.27"
      string ":1.28"
      string "org.gtk.vfs.GPhoto2VolumeMonitor"
      string ":1.29"
      string "ca.desrt.dconf"
      string "com.canonical.indicator.printers"
      string "org.gnome.SettingsDaemon"
      string "org.freedesktop.ScreenSaver"
      string "org.gnome.evolution.dataserver.Calendar7"
      string "org.gnome.SettingsDaemon.XRANDR"
      string "org.gtk.vfs.AfcVolumeMonitor"
      string "org.ayatana.bamf"
      string "org.freedesktop.FileManager1"
      string "com.canonical.indicator.bluetooth"
      string "org.PulseAudio1"
      string "org.gnome.Nautilus"
      string "org.gtk.vfs.GoaVolumeMonitor"
      string "com.canonical.indicator.keyboard"
      string "com.canonical.Unity"
      string ":1.70"
      string "org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx2320x2"
      string ":1.71"
      string "org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx2320x3"
      string "org.gnome.ScreenSaver"
      string "org.gnome.zeitgeist.Engine"
      string "org.gnome.evolution.dataserver.AddressBook9"
      string ":1.51"
      string ":1.74"
      string ":1.52"
      string ":1.30"
      string ":1.75"
      string ":1.53"
      string ":1.31"
      string ":1.76"
      string ":1.54"
      string "org.gnome.SettingsDaemon.Keyboard"
      string ":1.10"
      string ":1.77"
      string "org.gnome.evolution.dataserver.Subprocess.Backend.AddressBookx2463x2"
      string ":1.55"
      string ":1.11"
      string ":1.33"
      string ":1.78"
      string ":1.56"
      string ":1.12"
      string "com.canonical.AppMenu.Registrar"
      string ":1.34"
      string "org.kde.StatusNotifierWatcher"
      string ":1.79"
      string ":1.57"
      string ":1.0"
      string ":1.13"
      string ":1.35"
      string ":1.58"
      string ":1.1"
      string ":1.14"
      string ":1.36"
      string "org.gnome.zeitgeist.datahub"
      string ":1.59"
      string ":1.37"
      string "org.freedesktop.secrets"
      string ":1.2"
      string ":1.15"
      string "org.gtk.vfs.MTPVolumeMonitor"
      string ":1.38"
      string ":1.3"
      string ":1.16"
      string "org.gnome.zeitgeist.SimpleIndexer"
      string ":1.4"
      string ":1.5"
      string "org.gnome.Software"
      string "com.canonical.indicator.power"
      string "org.freedesktop.IBus"
      string ":1.6"
   ]

But I don't see the com.canonical.Unity.Session (or other for gnome) service.

Using com.canonical.Unity.Session service I can handle screen lock\unlock. I'm using it in my program, which will get the photo of man, who unlocked the screen. So at this moment this program works only on that machine, which is using com.canonical.Unity.Session service.

The question: How can I dynamically get the service as a string for my program?

PS. The link on the file, which is using DBUS https://github.com/alkhachatryan/spyonspies/blob/master/autorun.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.