Adding bindings for ed2k:// links with xdg-open

file-sharingfilesfreedesktop

I want to use a customized program to handle "ed2k://" links , it already got a "*.desktop" file , but how can I bind it with xdg-open as the default handler ?

Since I don't know the exact mimetype of "ed2k://" links , I had to ask here

Temporary solution

Modify xdg-open to handle "ed2k:%2F%2F" links , source code

Still looking for standard work arounds

Best Answer

The mimetype in question is:

x-scheme-handler/ed2k

I just tried it.

I installed amule and created a file userapp-amule.desktop in ~/.local/share/applications:

[Desktop Entry]
Name=aMule
Name[en_US]=userapp-amule
Exec=amule %u
Icon=amule
Terminal=false
Type=Application
Categories=Network;P2P;
Comment=A client for the eD2k network
MimeType=x-scheme-handler/ed2k

and I also added this line:

x-scheme-handler/ed2k=userapp-amule.desktop

to ~/.local/share/applications/mimeapps.list under [Default Applications] and [Added Associations]. I then opened an ed2k link with xdg-open (note the quotes):

xdg-open 'ed2k://|file|Some.String.Here%5D.%E4%B8%93%E8%BE%91.%28PDF%29.rar|74945828|3788c937a5d436cff6e6808b02d07339|h=4jk63hyesnpxk6xwm5rwgmb2mljxtixz|/'

and it worked:

: Initialising aMule SVN compiled with wxGTK2 v2.8.12 (Snapshot: rev. 10792)
: Checking if there is an instance already running...
: No other instances are running.
: ListenSocket: Ok.
: Loading temp files from /home/me/.aMule/Temp.