The problem
I'm trying to use dbus
to control multiple instances of VLC media player from the terminal.
Using dbus
for a single instance of VLC is no problem: as soon as VLC is started, commands like Play/Pause,
dbus-send --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause
work as expected. However, if I start a second instance of VLC, no dbus-send
commands are ever registered by it. The first instance still register all commands fine, but the second instance does not react.
What I've tried
dbus-launch vlc
I've tried using dbus-launch vlc
. Using only dbus-launch
creates a session bus instance and prints its unique identifying address. You can even see the instances running using ps -aux | grep dbus
. Using the address, you can send commands with dbus-send --address=X
.
However, when using dbus-launch vlc
, it will not print the information about the new bus to standard output (including its identifying address). So even if I could send commands to it using dbus-send
, I have no idea what address to use. There isn't a way to specify what address the news session bus instance should use either.
If I could somehow get the address of the new instance created by dbus-launch
, the problem would (theoretically) be solved.
dbus-daemon
Similarly to dbus-launch
, you can use dbus-daemon
to create a session bus instance, but you can also specify its address with the --address=X
flag. Using dbus-send --address=X
gives me a "Failed to open connection [...]" error though, and even if I were to solve that I have no idea how to hook a VLC instance to that specific session bus instance. I don't know how to proceed here.