voidrice/.local/bin/statusbar/torrent
anntnzrb 7c96bd081a
Compatibility for FreeBSD's paste(1) (#853)
* Compatibility for FreeBSD's paste(1)

According to FreeBSD's
[paste(1)](https://www.freebsd.org/cgi/man.cgi?query=paste&sektion=1&manpath=FreeBSD+12.2-RELEASE+and+Ports),
the extra `-` is needed (tested by myself).
This obviously works for Linux as well, tested on Void Linux at least.

> Create a colon-separated list of directories named bin,
> suitable for use in the PATH environment variable:

`find / -name bin -type d | paste -s -d : -`

* Compatibility for FreeBSD's paste(1)

According to FreeBSD's
[paste(1)](https://www.freebsd.org/cgi/man.cgi?query=paste&sektion=1&manpath=FreeBSD+12.2-RELEASE+and+Ports),
the extra `-` is needed (tested by myself).
This obviously works for Linux as well, tested on Void Linux at least.

> Create a colon-separated list of directories named bin,
> suitable for use in the PATH environment variable:

`find / -name bin -type d | paste -s -d : -`
2020-12-01 18:21:03 -05:00

27 lines
718 B
Bash
Executable file

#!/bin/sh
transmission-remote -l | grep % |
sed " # The letters are for sorting and will not appear.
s/.*Stopped.*/A 🛑/;
s/.*Seeding.*/Z 🌱/;
s/.*100%.*/N ✅/;
s/.*Idle.*/B 🕰️/;
s/.*Uploading.*/L ⬆️/;
s/.*%.*/M ⬇️/" |
sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e tremc ;;
2) td-toggle ;;
3) notify-send "🌱 Torrent module" "\- Left click to open tremc.
- Middle click to toggle transmission.
- Shift click to edit script.
Module shows number of torrents:
🛑: paused
🕰: idle (seeds needed)
🔼: uploading (unfinished)
🔽: downloading
✅: done
🌱: done and seeding" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac