Skip to content

MPD Configuration

gh0stzk edited this page Sep 6, 2023 · 1 revision

My setup installs MPD "Music Player Daemon" and NCMPCPP which is the music player. With these you can play music files saved on your computer.

My installer enables mpd at the user level, not at the system level.

Steps to follow to properly configure mpd

  • Once you have installed my dotfiles and you are in your bspwm session you need to edit these 3 files:

$HOME/.config/mpd/mpd.conf ;

music_directory "~/Music"

$HOME/.config/ncmpcpp/config ;

mpd_music_dir = ~/Music

$HOME/.config/bspwm/scripts/MediaControl ;

mpddir=~/Music

Look for those lines in each file and modify the directory where your music files are located. In the example are ~/Music directory.

In all 3 files, the directory must be the same.

  • Open the ncmpcpp player with shift + alt + k or open a terminal and type ncmpcpp. Once you open ncmpcpp press the "u" key to refresh the mpd database and your songs should appear.

You are done.

Problems

  • MPD does not start or has an error connecting to the host

Do you remember that I mentioned that in my configuration, mpd is enabled at the user level, not at the system level?

If you already had mpd installed, possibly it is enabled at the system level, to solve it simply disable the service with sudo systemctl disable mpd.service then enable it at the user level with systemctl --user enable mpd.service and reboot your system.

Polybar

My polybar configuration in all themes uses the polybar MPD module. Important notes to consider are that if you have not played a song for the first time the module will not appear, play a song and the module will appear there forever.

The mpd module in polybar only controls and displays songs with mpd and players that use mpd like ncmpcpp. Spotify, your browser, or other players will not be able to be controlled with polybar's mpd module. However, the widgets made with eww, such as cristina rice, pamela, or z0mbi3 can control the multimedia of any player with spotify or mpd.

Polybar's mpd module is limited in that it only plays local music hosted on your pc, and only from a source coming from mpd. However, nowadays hardly anyone hosts their music on their computer anymore, most people use spotify.

There is a module to control spotify https://github.com/mihirlad55/polybar-spotify-module you might want to take a look and implement it in your polybar.