Score:0

How can I define a Wine application to handle special links?

cn flag

Is it possible to activate a wine application when I click a URL having a specific method?

More specifically my question is this:

I have used amule in the past to handle ed2k: links. When I clicked an ed2k:… link on a web page, amule was handling that link. Later, I decided that eMule under Wine would be more efficient; so, I removed the amule Ubuntu package. Now, when I click to a URL like the following, nothing happens:

ed2k://|file|ubuntu-21.04-desktop-amd64.iso|2818738176|9F2FFA4B119C14F7539D4FB92D6B64EE|/

Similarly, the

xdg-open 'ed2k://|file|ubuntu-21.04-desktop-amd64.iso|2818738176|9F2FFA4B119C14F7539D4FB92D6B64EE|/'

command returns the error: gio: ed2k://…/: The specified location is not supported

So, how can I add support to GNOME to open that specific URL with a specific command, like:

nohup /usr/bin/wine /home/my_user/opt/eMule/emule.exe >/tmp/emule.out 2>/tmp/emule.err &
Score:0
cn flag

After googling around and with some trial and error, I found the following solution:

First, define the wine emule.exe "application" by creating a ~/.local/share/applications/emule.desktop file with the following contents:

[Desktop Entry]
Version=1.1
Name=eMule v0.60c wine
Type=Application
Terminal=false
MimeType=x-scheme-handler/ed2k
Exec=/usr/bin/wine /home/my_user/opt/eMule/emule.exe %u
Icon=/home/my_user/opt/eMule/EMule_mascot.svg
Path=/home/my_user/opt/eMule/
Categories=Network;P2P;
Comment=A client for the eD2k network
Comment[fr]=Un client pour le réseau eD2k
Comment[tr]=eD2k ağı için istemci
Comment[it]=Un client per la rete eD2k
Keywords=ed2k emule amule

Note: You can download the EMule_mascot.svg file from: https://upload.wikimedia.org/wikipedia/commons/4/4a/EMule_mascot.svg

Then, run the command

xdg-mime default emule.desktop x-scheme-handler/ed2k

to add the line x-scheme-handler/ed2k=emule.desktop to the end of file ~/.config/mimeapps.list.

After that, you can click to any link starting with ed2k: to launch your newly defined application with the link as parameter. Also, the

xdg-open 'ed2k://|file|ubuntu-21.04-desktop-amd64.iso|2818738176|9F2FFA4B119C14F7539D4FB92D6B64EE|/'

command will run as expected.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.