bcedu bcedu -3 years ago 136
Linux Question

Show application controls in audio menu (Linux)

I'm developing an audio player in Vala for linux (Im working in elementaryOS).

I would like to know which is the proper way to make apperar the controls (play/pause, next, pervious) of my application in the "audio menu" like other apps does (fot example banshee or the default music app of elementary):

enter image description here

I've been looking for docs about this but I haven't been able to found anything. I've even looked the source code from elementary music on github and I've found something interesting:

  • In the "main" they set an environment variable about media playing:

    GLib.Environ.set_variable ({"PULSE_PROP_media.role"}, "audio", "true");

  • In the desktop file there is a line also about media playing which says:


I've tried putting this lines in my code, but it still doesn't work.

I would like to know how it is done or if there is any documentation about this. Thanks!

Answer Source

I don't know about Elementary OS, but for GNOME I understand the controls on the tool bar are part of GNOME shell and so have to be written in Javascript. The best way of interfacing with your application is through the D-Bus Media Player Remote Interfacing Specification.

Both Banshee and Elementary OS's Music have code for implementing org.mpris.MediaPlayer2.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download