MPRIS

MPRIS (Media Player Remote Interfacing Specification) is a standard D-Bus interface which aims to provide a common programmatic API for controlling media players.

It provides a mechanism for discovery, querying and basic playback control of compliant media players, as well as a track list interface which is used to add context to the active media item.

Supported clients

Control utilities

Playerctl

The utility provides a command line tool to send commands to MPRIS clients. The most common commands are , and previous:

$ playerctl play-pause
$ playerctl next
$ playerctl previous

playerctl will send the command to the first player it finds. To select a player manually, use the --player option, e.g. . For better automation playerctl comes with a daemon that keeps track of media player activity and directs commands to the one with most recent activity. You can spun it into the background with:

$ playerctld daemon

In order to start playerctld when you log in, you may create the following systemd/User service:

You should then do a daemon-reload before enabling the service with the flag.

mpris-player-control

The mpris_player_control is a shell script which integrates and to control MPRIS clients. It supports the Play, Pause, PlayPause and Stop actions and sink volume control (mute/unmute/up/down) for Spotify.

Run to show basic script usage.

D-Bus

An alternative to the above is to manually use D-Bus, which should be available by default as it is a dependency of systemd.

For example, the following commands can be used to control Spotify:

$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
$ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop

Bluetooth

Media control from bluetooth headsets and similar devices may be forwarded to MPRIS.

Install the bluez-utils package and run . In order to start up mpris-proxy in the background and/or when your system starts, you may create a systemd/User service:

Then do a daemon-reload before you start/enable the service with the flag.

Tip: The mpris-proxy-serviceAUR package can be installed instead of manually creating the service.
gollark: You're unironically buying new elytra upon failure or something?
gollark: No you're not.
gollark: Huh. Weird.
gollark: Why does this surprise you? Haven't you *been* to the Apiaristics Division?
gollark: GTechâ„¢ has state-of-the-art hardware-accelerated daring.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.