Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Xubuntu 11.10, XFCE. I want to send DBus signals to the players so that they worked like in Gnome: you press 'play' key, it plays, 'next' - it forwards, and so on.

For that, I need to bind to the multimedia keys a set of commands like this:

dbus-send --dest=org.gnome.Rhythmbox ...

Now, I searched and can't find it: what signals should I send? I need only 3 events: play, forward and rewind.

Here's what I managed to do so far:

culebron@vostro:~/Work/game$ dbus-send --print-reply --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox org.gnome.Rhythmbox.Play
Error org.freedesktop.DBus.Error.UnknownMethod: Method "Play" with signature "" on interface "org.gnome.Rhythmbox" doesn't exist

culebron@vostro:~/Work/game$ dbus-send --print-reply --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox org.mpris.MediaPlayer2.Play
Error org.freedesktop.DBus.Error.UnknownMethod: Method "Play" with signature "" on interface "org.mpris.MediaPlayer2" doesn't exist
share|improve this question

1 Answer 1

up vote 2 down vote accepted

The signal sent is org.gnome.SettingsDaemon.MediaKeys.MediaPlayerKeyPressed on /org/gnome/SettingsDaemon/MediaKeys, with two arguments – the target program's name, which the program itself registers, and the key pressed ("Play", "Stop", "Next", "Previous").

signal sender=:1.3 -> dest=(null destination) serial=3047
 path=/org/gnome/SettingsDaemon/MediaKeys
 interface=org.gnome.SettingsDaemon.MediaKeys
 member=MediaPlayerKeyPressed
   string "gnome-mpris-keybind (mpd)"
   string "Play"

However, this will probably be of little use, since without g-s-d your player will fail to register itself and is not guaranteed to actually listen for this signal.

In some cases, you can skip this layer and control the music player directly – most players export a MPRIS2 interface at org.mpris.MediaPlayer2.playername, others have their custom interfaces which can be explored with D-Feet.

method call sender=:1.449 -> dest=org.mpris.MediaPlayer2.mpd serial=17
  path=/org/mpris/MediaPlayer2;
  interface=org.mpris.MediaPlayer2.Player;
  member=PlayPause
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.