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.7 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. if [ "$IDENTIFIER" = "unicode" ]; then
  17. case "$STATUS" in
  18. "Idle")
  19. printf "🛑 %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  20. ;;
  21. "Seeding")
  22. printf "🌱 %s | ⬆%s ⬇%s\n" "$NAME" "$UP" "$DOWN"
  23. ;;
  24. "Downloading")
  25. printf "⏬ %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  26. ;;
  27. esac
  28. else
  29. case "$STATUS" in
  30. "Idle")
  31. printf "IDLE %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  32. ;;
  33. "Seeding")
  34. printf "SEEDING %s | ⬆%s ⬇%s\n" "$NAME" "$UP" "$DOWN"
  35. ;;
  36. "Downloading")
  37. printf "DOWNLOADING %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
  38. ;;
  39. esac
  40. fi
  41. fi
  42. }
  43. dwm_transmission