dotfiles

Mahdi's dotfiles
git clone git://mahdi.pw/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

torrent-from-clip (356B)


      1 #!/bin/sh
      2 NOTIFY_MSG=" Added Torrent
      3 %PASTE%"
      4 
      5 while :; do
      6 	clip=$(xclip -selection c -o)
      7 	case "$clip" in
      8 		magnet:*)
      9 			url=$(cat ~/.cache/url.txt || echo 0)
     10 			if [ "$url" != "$clip" ]; then
     11 				qbittorrent-nox "$clip"
     12 				echo "$clip" > ~/.cache/url.txt
     13 				MSG=$(echo "$NOTIFY_MSG" | sed "s|%PASTE%|$clip|")
     14 				notify "$MSG"
     15 			fi
     16 		;;
     17 	esac
     18 done