Cmus doesn't support detaching natively. However, using screen and a shell script, you can have very similar behavior. Save this bash script under a directory in your PATH that is read before the directory where the cmus binary is located, e.g. $HOME/bin/cmus:
#!/bin/bash if ! screen -r -D cmus >/dev/null ; then screen -S cmus /usr/bin/cmus "$@" fi
Make sure the script is executed instead of the normal binary by putting it at first position in your PATH variable, e.g. by setting
export PATH=$HOME/bin:$PATH
in your ~/.bashrc.
Now in cmus, set the q key to screen detach:
:bind -f common q shell screen -d cmus
Finished! This way, if you press q cmus will simply go in the background (really fast), and by typing cmus in the shell you just resume where you left of. If you want to really quit cmus, you can simply enter
:quit