mpd.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #! /bin/zsh
  2. # MPD/MPC by olshrimpeyes
  3. nowplaying=`mpc | grep - | sed -e 's/\&/&/g'`
  4. playing=`mpc | grep playing`
  5. print "<openbox_pipe_menu>"
  6. print "<item label=\"Music Player\"><action name=\"Execute\"><execute>$TERM -e ncmpcpp</execute></action></item>"
  7. print "<separator/>"
  8. if [[ -z $nowplaying ]]
  9. then
  10. print "<item label=\"Not Playing\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  11. else
  12. print "<item label=\""$nowplaying"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  13. if [[ -z $playing ]]
  14. then
  15. print "<item label=\"Paused\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  16. else
  17. print "<item label=\""$playing"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  18. fi
  19. fi
  20. print "<separator/>"
  21. if [[ -z $playing ]]
  22. then
  23. print "<item label=\"Play\"><action name=\"Execute\"><execute>mpc play</execute></action></item>"
  24. else
  25. print "<item label=\"Pause\"><action name=\"Execute\"><execute>mpc pause</execute></action></item>"
  26. print "<item label=\"Stop\"><action name=\"Execute\"><execute>mpc stop</execute></action></item>"
  27. fi
  28. print "<item label=\"Next\"><action name=\"Execute\"><execute>mpc next</execute></action></item>"
  29. print "<item label=\"Previous\"><action name=\"Execute\"><execute>mpc prev</execute></action></item>"
  30. print "<item label=\"Volume\"><action name=\"Execute\"><execute>$TERM -e alsamixer</execute></action></item>"
  31. print "</openbox_pipe_menu>"