dwm-bar for archlinux
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.

36 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
  1. #!/bin/sh
  2. # A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. # Dependencies: cmus
  6. dwm_cmus () {
  7. if ps -C cmus > /dev/null; then
  8. ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}')
  9. TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}')
  10. POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}')
  11. DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}')
  12. STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}')
  13. SHUFFLE=$(cmus-remote -Q | grep -a '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
  14. if [ $STATUS == "playing" ]; then
  15. STATUS="\U25B6"
  16. else
  17. STATUS="\U23F8"
  18. fi
  19. if [ $SHUFFLE == "true" ]; then
  20. SHUFFLE=" \U1F500"
  21. else
  22. SHUFFLE=""
  23. fi
  24. printf "[$STATUS $ARTIST - $TRACK "
  25. printf "%0d:%02d/" $(($POSITION%3600/60)) $(($POSITION%60))
  26. printf "%0d:%02d" $(($DURATION%3600/60)) $(($DURATION%60))
  27. printf "$SHUFFLE]\n"
  28. fi
  29. }
  30. dwm_cmus