music (868B)
1 #!/usr/bin/env bash 2 3 # Italic if paused 4 filter() { 5 sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\\/span>/g" 6 } 7 8 case $BLOCK_BUTTON in 9 1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp ;; # left click, bring up player 10 2) mpc toggle | filter ;; # middle click, toggle play/bause 11 3) mpc status | filter && notify-send "🎵 Music module: 12 - Shows mpd song playing. 13 - Italic when paused. 14 - Left click opens ncmpcpp. 15 - Middle click pauses. 16 - Scroll changes track.";; # right click, infobox 17 4) mpc prev | filter ;; # scroll up, previous 18 5) mpc next | filter ;; # scroll down, next 19 *) mpc status | filter ;; 20 esac 21 22 status=$(mpc status | filter) 23 24 if [[ "${status}" != "" ]]; then 25 echo 26 else 27 echo "NONE" 28 fi