Hund

How to control mpv via the shell using Playerctl and mpv-pris

December 6, 2020

With the help of Playerctl it’s possible to control various media players like mpv, VLC, cmus, mpd, Spotify and even web browsers using the shell. Because I’m only using mpv myself, that’s what I’m going to talk about here.

For this to work you need a plugin called mpv-mpris. It adds support for controlling mpv using the standard media keys by implementing support for the MPRIS D-Bus Interface Specification.

Installation of mpv-mpris

You can either download the latest stable release or clone the latest code using git:

$ git clone https://github.com/hoyon/mpv-mpris         

You can then compile the code:

$ make  
$ make install 

It’s important to not use root with make install, if you do that, it will then copy the plugin to the wrong folder /root/.config/mpv/scritps/ and not to your own folder ~/.config/mpv/scripts/.

Installation of playerctl

The package playerctl should be available in mosts repositories. In Gentoo, it’s called media-sound/playerctl.

Usage

You can now control mpv with Playerctl using the command playerctl <function>. You can list all available commands and features by just executing the command playerctl without any arguments.

Meta

No Comments

Use the e-mail form, if you wish to leave feedback for this post. Markdown is supported. [Terms of service]