olshrimpeyes

pipe menu bash

Dec 4th, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.49 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. echo "<openbox_pipe_menu>"
  8. echo "<item label=\"Music Player\"><action name=\"Execute\"><execute>terminator --geometry 554x162 -e ncmpcpp</execute></action></item>"
  9. echo "<separator/>"
  10. if  [[ -z $nowplaying ]]
  11.  
  12. then
  13.  
  14. echo "<item label=\"Not Playing\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  15.  
  16. else
  17.  
  18. echo "<item label=\""$nowplaying"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  19.  
  20. if [[ -z $playing ]]
  21.  
  22. then
  23.  
  24. echo "<item label=\"Paused\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  25.  
  26. else
  27.  
  28. echo "<item label=\""$playing"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
  29.  
  30. fi
  31.  
  32. fi
  33.  
  34. echo "<separator/>"
  35.  
  36. if [[ -z $playing ]]
  37.  
  38. then
  39.  
  40. echo "<item label=\"Play\"><action name=\"Execute\"><execute>mpc play</execute></action></item>"
  41.  
  42. else
  43.  
  44. echo "<item label=\"Pause\"><action name=\"Execute\"><execute>mpc pause</execute></action></item>"
  45. echo "<item label=\"Stop\"><action name=\"Execute\"><execute>mpc stop</execute></action></item>"
  46.  
  47. fi
  48.  
  49. echo "<item label=\"Next\"><action name=\"Execute\"><execute>mpc next</execute></action></item>"
  50. echo "<item label=\"Previous\"><action name=\"Execute\"><execute>mpc prev</execute></action></item>"
  51. echo "<item label=\"Volume\"><action name=\"Execute\"><execute>terminator -e alsamixer</execute></action></item>"
  52. echo "</openbox_pipe_menu>"
Advertisement
Add Comment
Please, Sign In to add comment