Using Media Control Keys With mpv
I like to use my media control keys for controlling audio and video playback on my system. Using GNOME on Ubuntu, support for that comes out of the box and works nicely with programs like Spotify or VLC.
On other systems, installing playerctl
is an easy way to retrofit this functionality and after assigning the media control keys to the various
commands provided by
playerctl, support is at least as good as on GNOME.
Unfortunately, my favourite media player mpv does not support media keys out of the box, so recently I went on a search to enable support for my media control keys in mpv.
Turns out there’s a D-Bus standard behind the media control key support called MPRIS. Media players implementing this can be controlled programmatically using a common API.
Having found this, another search yielded an existing plugin for mpv called mpv-mpris.
It is available in the Ubuntu repositories and after installing it,
mpv reacts to all my media control
keys and I’m happy. 😊