Control media playback on Linux using playerctl. Play, pause, skip, control volume for Spotify, VLC, and other media players. Use when a user asks FRIDAY to play music, pause, skip track, or control media on Linux.
Use playerctl to control media players (Spotify, VLC, Firefox, Chrome, etc.) from the terminal. This is the standard way to control media on Linux.
Install playerctl:
sudo apt-get install -y playerctl
playerctl play
playerctl pause
playerctl play-pause
playerctl stop
playerctl next
playerctl previous
playerctl volume
playerctl volume 0.5
playerctl volume 0.1+
playerctl volume 0.1-
playerctl volume 0
playerctl metadata
playerctl metadata title
playerctl metadata artist
playerctl metadata album
playerctl position
playerctl metadata mpris:length
playerctl metadata mpris:artUrl
playerctl metadata --format "{{ artist }} - {{ title }}"
playerctl position 30
playerctl position 10+
playerctl position 10-
playerctl --list-all
playerctl --player=spotify play
playerctl --player=vlc pause
playerctl --player=firefox next
playerctl --all-players pause
playerctl --ignore-player=chromium play-pause
playerctl status
Returns: Playing, Paused, or Stopped
if [ "$(playerctl status)" = "Playing" ]; then
echo "Music is playing"
fi
playerctl shuffle
playerctl shuffle on
playerctl shuffle off
playerctl shuffle toggle
playerctl loop
playerctl loop None
playerctl loop Track
playerctl loop Playlist
playerctl open "spotify:track:4iV5W9uYEdYUVa79Axb7Rh"
playerctl open "https://example.com/song.mp3"
playerctl metadata --follow --format "Now playing: {{ artist }} - {{ title }}"
playerctl --follow status
playerctl --player=spotify metadata
playerctl --player=spotify metadata mpris:trackid
playerctl --player=spotify open spotify:track:TRACK_ID
notify-send "Now Playing" "$(playerctl metadata --format '{{ artist }} - {{ title }}')"
# Add to screen lock script
playerctl pause
playerctl play-pause
if [ "$(playerctl status)" = "Playing" ]; then
notify-send "Playing" "$(playerctl metadata title)"
else
notify-send "Paused"
fi
# Get volume
pactl get-sink-volume @DEFAULT_SINK@
# Set volume
pactl set-sink-volume @DEFAULT_SINK@ 50%
# Increase volume
pactl set-sink-volume @DEFAULT_SINK@ +10%
# Decrease volume
pactl set-sink-volume @DEFAULT_SINK@ -10%
# Mute toggle
pactl set-sink-mute @DEFAULT_SINK@ toggle
# Increase volume
amixer set Master 10%+
# Decrease volume
amixer set Master 10%-
# Mute toggle
amixer set Master toggle
playerctl --list-all to see available players.