Linux operating systems are great for making unique customizations and tweaks to make your computer work better for you. For example, the i3 window manager encourages users to think about the different components and pieces that make up the modern Linux desktop.
Fedora has two new packages of interest for music tweakers: mpris-scrobbler and playerctl. mpris-scrobbler tracks your music listening history on a music-tracking service like Last.fm and/or ListenBrainz. playerctl is a command-line music player controller.
mpris-scrobbler records your music listening trends
mpris-scrobbler is a CLI application to submit play history of your music to a service like Last.fm, Libre.fm, or ListenBrainz. It listens on the MPRIS D-Bus interface to detect what’s playing. It connects with several different music clients like spotify-client, vlc, audacious, bmp, cmus, and others.
Install and configure mpris-scrobbler
mpris-scrobbler is available for Fedora 28 or later, as well as the EPEL 7 repositories. Run the following command in a terminal to install it:
sudo dnf install mpris-scrobbler
Once it is installed, use systemctl to start and enable the service. The following command starts mpris-scrobbler and always starts it after a system reboot:
systemctl --user enable --now mpris-scrobbler.service
Submit plays to ListenBrainz
This article explains how to link mpris-scrobbler with a ListenBrainz account. To use Last.fm or Libre.fm, see the upstream documentation.
To submit plays to a ListenBrainz server, you need a ListenBrainz API token. If you have an account, get the token from your profile settings page. When you have a token, run this command to authenticate with your ListenBrainz API token:
$ mpris-scrobbler-signon token listenbrainz
Token for listenbrainz.org:
Finally, test it by playing a song in your preferred music client on Fedora. The songs you play appear on your ListenBrainz profile.
playerctl controls your music playback
playerctl is a CLI tool to control any music player implementing the MPRIS D-Bus interface. You can easily bind it to keyboard shortcuts or media hotkeys. Here’s how to install it, use it in the command line, and create key bindings for the i3 window manager.
Install and use playerctl
playerctl is available for Fedora 28 or later. Run the following command in a terminal to install it:
sudo dnf install playerctl
Now that it’s installed, you can use it right away. Open your preferred music player on Fedora. Next, try the following commands to control playback from a terminal.
To play or pause the currently playing track:
If you want to skip to the next track:
For a list of all running players:
To play or pause what’s currently playing, only on the spotify-client app:
playerctl -p spotify play-pause
Create playerctl key bindings in i3wm
Do you use a window manager like the i3 window manager? Try using playerctl for key bindings. You can bind different commands to different key shortcuts, like the play/pause buttons on your keyboard. Look at the following i3wm config excerpt to see how:
# Media player controls
bindsym XF86AudioPlay exec "playerctl play-pause"
bindsym XF86AudioNext exec "playerctl next"
bindsym XF86AudioPrev exec "playerctl previous"
Try it out with your favorite music players
Need to know more about customizing the music listening experience on Fedora? The Fedora Magazine has you covered. Check out these five cool music players on Fedora:
Bring order to your music library chaos by sorting and organizing it with MusicBrainz Picard: