Skip to content
Robbert Gurdeep Singh edited this page Apr 15, 2018 · 5 revisions

This is an example script (and settings) for how to bind a key in cmus, which will execute a shell command on the track under the cursor. It passes the filename (absolute path) of the track to a command of your choice. In the example below it's a id3 tag editor.

Here's the script:

#!/bin/bash
file="$(cmus-remote -C 'echo {}')"
 
if [ -f "$file" ]
then
         mrxvt -e /usr/bin/mp3info -i "$file" &
else
         echo "Oops, couldn't find selected track" >&2
fi

So download that (click the title/tab of the code section.) then rename it and make it executable:

mv downloads/cmus_edit_tags.txt ~/bin/cmus_edit_tags
chmod +x ~/bin/cmus_edit_tags

Then you'll need to bind a key in cmus to call the script. Put this in your ~/.cmus/rc:

bind common 0 shell ~/bin/cmus_edit_tags

Replace the 0 with the key you want to press.

Then restart cmus.