2018-12-13 12:07:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
[ $(mpc | wc -l) -eq 1 ] && {
|
|
|
|
printf '<span color="#7f7f7f">\uf9da</span>'
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2019-02-28 14:42:56 +00:00
|
|
|
title=$(mpc | head -n1 | tr -cd "[:print:]")
|
2018-12-13 12:07:39 +00:00
|
|
|
state=$(mpc | grep '^\[' | sed -E 's/^\[(.+)\].*/\1/')
|
|
|
|
|
|
|
|
case ${state} in
|
|
|
|
playing)
|
|
|
|
printf '\uf909 <span color="#8faafc">%s</span>' "${title}"
|
|
|
|
;;
|
|
|
|
paused)
|
|
|
|
printf '\uf8e3 <span color="#7f7f7f">%s</span>' "${title}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
printf '<span color="#dd0000">State: %s Title: %s<span>' ${state} "${title}"
|
|
|
|
;;
|
|
|
|
esac
|