Configuration file for dwm-bar on macbook air
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

4 years ago
  1. #!/bin/sh
  2. # A dwm_bar function that shows the current artist, track, position, duration, and status from mpc
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. # Dependencies: mpc
  6. dwm_mpc () {
  7. if ps -C mpd > /dev/null; then
  8. ARTIST=$(mpc current -f %artist%)
  9. TRACK=$(mpc current -f %title%)
  10. POSITION=$(mpc status | grep "%)" | awk '{ print $3 }' | awk -F/ '{ print $1 }')
  11. DURATION=$(mpc current -f %time%)
  12. STATUS=$(mpc status | sed -n 2p | awk '{print $1;}')
  13. SHUFFLE=$(mpc status | tail -n 1 | awk '{print $6}')
  14. if [ "$IDENTIFIER" = "unicode" ]; then
  15. if [ "$STATUS" = "[playing]" ]; then
  16. STATUS="▶"
  17. else
  18. STATUS="⏸"
  19. fi
  20. if [ "$SHUFFLE" = "on" ]; then
  21. SHUFFLE=" 🔀"
  22. else
  23. SHUFFLE=""
  24. fi
  25. else
  26. if [ "$STATUS" = "[playing]" ]; then
  27. STATUS="PLA"
  28. else
  29. STATUS="PAU"
  30. fi
  31. if [ "$SHUFFLE" = "on" ]; then
  32. SHUFFLE=" S"
  33. else
  34. SHUFFLE=""
  35. fi
  36. fi
  37. printf "%s%s %s - %s %s/%s%s%s" "$SEP1" "$STATUS" "$ARTIST" "$TRACK" "$POSITION" "$DURATION" "$SHUFFLE" "$SEP2"
  38. fi
  39. }
  40. dwm_mpc