mpvctl
View this project on GitHub.
mpvctl is a shell script for controlling mpv via its socket interface. I wrote this to have more advanced control over mpv using my keybindings in dwm.
Dependencies
- mpvSockets for managing multiple mpv sockets
- jq for JSON parsing
- socat for socket communication
Documentation
In the following documentation, MR refers to the most-recently-opened instance of mpv.
Program arguments
Usage: mpvctl command [PATTERN]
Positional arguments
command- The command for mpvctl to run. One of:
toggle- Toggle play/pause for MR. If no instance of mpv is running, run the command defined in
$MPVCMD toggle_all- Toggle play/pause for all instances of mpv
prev- Play the previous item in the playlist of MR
next- Play the next item in the playlist of MR
get_file- Echo the filename of the file currently being played by MR
is_paused- Echo true if MR is paused and false otherwise
play- Unpause MR if
patternis not specified, otherwise pause MR then play files in$MUSICPATHmatchingpattern pause- Pause MR
stop- Kill MR and delete its socket
Optional arguments
pattern- A search string for finding files to play when using the
playcommand. Can be several words, but no glob or regex matching is performed
Configuration
Variables
To do
- More control options (e.g. alter volume)
- Make more UNIX-like