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.

50 lines
1.8 KiB

  1. #!/bin/sh
  2. # A dwm_bar function to show the status of a torrent woth transmission-remote
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. # Dependencies: transmission-remote
  6. dwm_transmission () {
  7. TORRENT=$(transmission-remote -l | sed '2q;d' | sed 's/\(.\) /\1/g')
  8. ID=$(printf "%s" "$TORRENT" | awk '{print $1;}')
  9. STATUS=$(printf "%s" "$TORRENT" | awk '{print $8;}')
  10. ETA=$(printf "%s" "$TORRENT" | awk '{print $4;}')
  11. NAME=$(printf "%s" "$TORRENT" | awk '{for(i=9;i<=NF;++i)print $i}' | tr -d "\n" | head -c 20; printf "...")
  12. DONE=$(printf "%s" "$TORRENT" | awk '{print $2;}')
  13. UP=$(printf "%s" "$TORRENT" | awk '{print $5;}')
  14. DOWN=$(printf "%s" "$TORRENT" | awk '{print $5;}')
  15. if [ "$ID" != "Sum:" ]; then
  16. printf "%s" "$SEP1"
  17. if [ "$IDENTIFIER" = "unicode" ]; then
  18. case "$STATUS" in
  19. "Idle")
  20. printf "🛑 %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  21. ;;
  22. "Seeding")
  23. printf "🌱 %s | ⬆%s ⬇%s" "$NAME" "$UP" "$DOWN"
  24. ;;
  25. "Downloading")
  26. printf "⏬ %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  27. ;;
  28. esac
  29. else
  30. case "$STATUS" in
  31. "Idle")
  32. printf "IDLE %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  33. ;;
  34. "Seeding")
  35. printf "SEEDING %s | ⬆%s ⬇%s" "$NAME" "$UP" "$DOWN"
  36. ;;
  37. "Downloading")
  38. printf "DOWNLOADING %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  39. ;;
  40. esac
  41. fi
  42. printf "%s\n" "$SEP2"
  43. fi
  44. }
  45. dwm_transmission