Skip to content

Instantly share code, notes, and snippets.

@matburt
Created March 3, 2011 18:36
Show Gist options
  • Save matburt/853242 to your computer and use it in GitHub Desktop.
Save matburt/853242 to your computer and use it in GitHub Desktop.
Colored mpd.sh for xmobar
MPD="$(mpc | head -n 2 | tr '\n' ' ' | sed 's/^\(.*\)\( \[.*\)/\1/')"
MPD_STATE="$(mpc | head -n 2 | tr '\n' ' ' | grep -oG '\[.*\]')"
if [ -z "$MPD" ]; then
echo "<fc=#ff5500>no music</fc>"
else
if [ "$MPD_STATE" = "[paused]" ]; then
echo "<fc=#ff5500>$MPD</fc>"
elif [ -z "$MPD_STATE" ]; then
echo "<fc=#ff5500>no music</fc>"
else
echo "<fc=#0055ff>$MPD</fc>"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment