| 1 | #!/bin/sh |
| 2 | |
| 3 | # Starting transmission-daemon if not already running |
| 4 | # transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. |
| 5 | pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon...") |
| 6 | sleep 3 |
| 7 | |
| 8 | # adding the Torrent |
| 9 | if [ -z "$*" ]; then |
| 10 | magnetlink="$(xclip -sel c -o)" |
| 11 | transmission-remote -a "$magnetlink" && notify-send "🔽 Torrent added." |
| 12 | else |
| 13 | transmission-remote -a "$@" && notify-send "🔽 Torrent added." |
| 14 | fi |