~/articles/ditching-apples-musicapp-in-favour-of-cmus

“cmus” is a command line music player known for its simplicity. Its functionalities are far more superior and complete than those of Music.app. i.e. cmus has “aaa mode” that allows user to define the range of songs in which shuffle mode and repeat mode operates. Music.app is probably built on catalyst, Apple’s framework to build apps for both Macs, iPhones and iPads. Maybe that’s why that the Music.app is overly dependent on mouse input that feels off. On the other hand, cmus can be completely controlled by the keyboard with vim style key binding: typing a slash is enough to search your library!

cmus fully set up

I use three complementary programs to cmus: cmusfm, cmus-control and cmus-lyrics

cmusfm

cmusfm is a program that tracks your music with last.fm’s free API. It’s called on everything track change, so I suppose it’s quite light on the battery.

cmus-control

cmus-control listens for keyboard events and manages the media key events.

cmus-control was a lot more troublesome to set up. For some reason, launching the service cmus-control with brew doesn’t work, nor does loading and kickstarting directly the plist file with launchctl. I then used a non-elegant solution of bodging a fish function as follows:

function cmus
    /opt/homebrew/bin/cmuscontrold &> /dev/null &
    /opt/homebrew/bin/cmus
end

Doing so essentially binds cmuscontrold with cmus itself, with cmus terminated every time cmus (the function) is killed. cmuscontrold would never be started when cmus isn’t running

cmus-lyrics

This program parses the output of cmus-remote -Qand prints continuously the lyrics of the currently playing song. It doesn’t integrate into cmus itself and requires some display space. I created another fish function to use tmux to put it alongside with cmus.

I also need to set the terminal colour to xterm-256color, otherwise cmus won’t launch, or it wouldn’t use 24bit true colour.

function tmuxcmus
    /opt/howebrew/bin/tmux \
        new-session "set TERM xterm-256color ; cmus" \; \
        split-window cmus-lyrics \; \
        select-layout main-horizontal \; \
        select-pane -t 0
end
<newer   earlier>