following this little hack, my goal is to upload any magnet link to my "remote" Desktop PC: https://blog.flo.cx/2011/02/how-to-open-magnet-links-on-a-remote-transmission-daemon-with-one-click/

Unfortunately the Guide is from 2011 and uses gconftools which does not work on my machine. From what I understand my Ubuntu 14.04 with Unity uses xdg-mime and/or gvfs-mime to set the desired action, but everything I tried so far did not work and google didn't give any results concerning scripts. man pages did't help me either. :/

Can anyone more experienced with this mime stuff help me get the right command?

TL;DR: What I want is to set the default action for magnet links to running a script instead of opening transmission.


With the use of .desktop files, I finally got it working. Here is my solution:

  1. create script to upload magnet link to PC running transmission:
test -z $1 && echo "need magnet link!" && exit
PASS=#apparently ";" does not work
#add torrent paused?
SESSID=$(curl --silent --anyauth --user $USER:$PASS "http://$HOST:$PORT/transmission/rpc" | sed 's/.*//g;s/.*//g')
curl --silent --anyauth --user $USER:$PASS --header "$SESSID" "http://$HOST:$PORT/transmission/rpc" -d "{\"method\":\"torrent-add\",\"arguments\":{\"paused\":${PAUSED},\"filename\":\"${LINK}\"}}"

[sorry, the formatting is horrible. can't get it to work. "<code>" and other chars inside the codeblock get interpreted and are NOT DISPLAYED. please check the link for full script code: https://blog.flo.cx/2011/02/how-to-open-magnet-links-on-a-remote-transmission-daemon-with-one-click/ ]

  1. create .desktop file which executes the above script and place the file in /usr/share/applications/:
[Desktop Entry]
Comment=executes script to upload magnet link to desktop pc
Exec=/home/username/MagnetLinkTransfer.sh %u

note the %u as argument for execute script!

  1. set action/application for xdg-open
xdg-mime default MagnetLinkTransfer.desktop x-scheme-handler/magnet
gvfs-mime --set x-scheme-handler/magnet MagnetLinkTransfer.desktop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.