olshrimpeyes

pipe menu

Dec 4th, 2013
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.47 KB | None | 0 0
  1. #! /bin/zsh
  2.  
  3. # MPD/MPC by olshrimpeyes
  4. nowplaying=`mpc | grep - | sed -e 's/\&/&/g'`
  5. playing=`mpc | grep playing`
  6.  
  7. print "<openbox_pipe_menu>"
  8. print "<item label=\"Music Player\"><action name=\"Execute\"><execute>$TERM -e ncmpcpp</execute></action></item>"
  9. print "<separator/>"
  10. if  [[ -z $nowplaying ]]
  11.  
  12. then
  13.  
  14. print "<item label=\"Not Playing\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  15.  
  16. else
  17.  
  18. print "<item label=\""$nowplaying"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  19.  
  20. if [[ -z $playing ]]
  21.  
  22. then
  23.  
  24. print "<item label=\"Paused\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  25.  
  26. else
  27.  
  28. print "<item label=\""$playing"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  29.  
  30. fi
  31.  
  32. fi
  33.  
  34. print "<separator/>"
  35.  
  36. if [[ -z $playing ]]
  37.  
  38. then
  39.  
  40. print "<item label=\"Play\"><action name=\"Execute\"><execute>mpc play</execute></action></item>"
  41.  
  42. else
  43.  
  44. print "<item label=\"Pause\"><action name=\"Execute\"><execute>mpc pause</execute></action></item>"
  45. print "<item label=\"Stop\"><action name=\"Execute\"><execute>mpc stop</execute></action></item>"
  46.  
  47. fi
  48.  
  49. print "<item label=\"Next\"><action name=\"Execute\"><execute>mpc next</execute></action></item>"
  50. print "<item label=\"Previous\"><action name=\"Execute\"><execute>mpc prev</execute></action></item>"
  51. print "<item label=\"Volume\"><action name=\"Execute\"><execute>$TERM -e alsamixer</execute></action></item>"
  52. print "</openbox_pipe_menu>"
Advertisement
Add Comment
Please, Sign In to add comment