#!/bin/sh # mpcob - control mpc in your openbox menu # 02/03/10 - supulton - vrfeight3@gmail.com # chmod +x mpcob.sh, and place: # "
" # somewhere in your menu. # replace "urxvtc" with your preferred terminal set_term=`echo urxvt` # gui mpd preference? set_player=`echo ncmpcpp` #set variables playing=`mpc -f "%track%. %artist% - %title%" | sed -n '1p'` nowstatus=`mpc | sed -n '2p' | cut -d ' ' -f1` repeat=`mpc | tail -n 1 | cut -c 15-25` random=`mpc | tail -n 1 | cut -c 29-39` single=`mpc | tail -n 1 | cut -c 43-53` consume=`mpc | tail -n 1 | cut -c 57-` # tell when mpc is stopped if [ "$nowstatus" != "[Playing]" -a "$nowstatus" != "[Paused]" ] then export nowstatus=`echo "[Stopped]"` fi if [ "$nowstatus" = "[Stopped]" ] then export Playing=`echo Play` fi # convert reserved XML characters '&', '<', '>', '"' for songs containing characters if [[ $playing =~ '&' ]] then export playing=${playing//\&/\&\;} fi if [[ $playing =~ '<' ]] then export playing=${playing//\\<\;} fi if [[ $playing =~ '>' ]] then export playing=${playing//\>/\>\;} fi if [[ $playing =~ '"' ]] then export playing=${playing//\"/\"\;} fi # echo menu echo "" echo "