PLAYERCTL(1) | General Commands Manual | PLAYERCTL(1) |
playerctl
—
control media players via MPRIS
playerctl |
[-aFhlV ] [-f
FORMAT] [-i
NAME] [-p
NAME] command |
The playerctl
utility controls
MPRIS-enabled media players. In addition to offering play, pause and stop
control, playerctl
also offers previous and next
track support, the ability to seek backwards and forwards in a track, and
volume control. playerctl
also supports displaying
metadata (e.g., artist, title, album) for the current track, and showing the
status of the player.
Players that can be controlled using
playerctl
include audacious(1),
cmus(1), mopidy(1),
mpd(1), quodlibet(1),
rhythmbox(1), vlc(1) and
xmms2(1). However, any player that implements the MPRIS
interface specification can be controlled using
playerctl
including web browsers.
Playerctl also comes with a daemon called
playerctld
which keeps track of media player
activity. When playerctld
is running,
playerctl
commands will act on the media player with
the most recent activity. Run the command playerctld
daemon
to start the daemon.
The options are as follows:
-a
,
--all-players
-F
,
--follow
-f
FORMAT, --format
FORMAT-h
,
--help
-i
NAME, --ignore-player
NAME-l
,
--list-all
-p
NAME, --player
NAME-s,
--no-messages
-V
,
--version
The commands are as follows:
status
play
pause
play-pause
stop
next
previous
position
[OFFSET[+|-]]volume
[LEVEL[+|-]]metadata
[KEY]open
URIshuffle
[On
| Off
|
Toggle
]On
,
Off
, or Toggle
loop
[None
| Track
|
Playlist
]None
(disable looping),
Track
(loop the current track), or
Playlist
(loop the current playlist).The output of the position
,
metadata
, status
and
volume
commands can be controlled using a format
string. Variables set by these commands can be included in the format string
by enclosing them in curly braces:
‘{{var}}
’. These
will then be expanded on output.
Each command has access to the following variables:
Each property listed in the metadata
command are also set as variables. It is recommended to check this list for
each player, as different players may not set the same properties. See the
MPRIS v2 metadata guidelines for a list of all
properties in the MPRIS specification. The most common properties are as
follows:
Helper functions are also available to transform
expanded variables into other representations. They are called in the form
‘{{
’.
The helper functions are as follows:func
(var)}}
lc
(str)uc
(str)markup_escape
(str)default
(str1,
str2)duration
(time)hh:mm:ss
’. Can only be called with
position or mpris:length.emoji
(key)The template language is also able to perform basic math operations.
References to unknown functions will cause
playerctl
to exit with an error. References to
unknown variables will be expanded to empty strings. Text not enclosed in
braces will be printed verbatim.
The playerctl
utility exits 0 on
success, and >0 if an error occurs.
Print the player name, playback status in lowercase, and position and length in human readable form:
$ playerctl metadata --format '{{playerName}}: {{lc(status)}} '\ '{{duration(position)}}|{{duration(mpris:length)}}'
MPRIS v2 metadata guidelines, freedesktop.org, https://freedesktop.org/wiki/Specifications/mpris-spec/metadata/, September 18, 2013.
playerctl homepage, playerctl API documentation, GObject introspection language bindings
The playerctl
utility is maintained by
Tony Crisci
<tony@dubstepdish.com>
and is made available under the GNU Lesser General Public License 3.0.
This reference was written by Nick Morrott <knowledgejunkie@gmail.com> for the Debian GNU/Linux project. It was later updated and expanded by Stephen Gregoratto <dev@sgregoratto.me>.
November 30, 2020 | Debian |