You are not logged in.
Hi,
First of all I'm a tad new, so I hope this is the correct place to post this since I feel like this is a basic problem.
I'm trying to get chrome (not chromium) to open magnet links with deluge. I have it working now but am quite unsure about my approach and whether there is something else I can do that's a bit cleaner.
The mime type default is set correctly according to:
$ xdg-mime query default x-scheme-handler/magnet
deluge.desktopThe desktop entry is also available at
$ ls /usr/share/applications/deluge.desktop
/usr/share/applications/deluge.desktopI remember a chrome popup asking if I wanted to open links with xdg-open, so I tried to execute a magnet link with the command. This resulted in the same behaviour as clicking the magnet link in chrome, which opened up a new browser tab.
So at deads end, I opened up xdg-open and examined the code. What the script basically does is determine the desktop environment, and handle the request accordingly.
Now I am on OpenBox, which means that I ended up in the generic execution bracket, namely function open_generic().
The function roughly looks like this:
open_generic()
{
if is_file_url_or_path "$1"; then
#handle opening file
fi
if [ -n "$BROWSER" ]; then
open_envvar "$1"
fi
if [ -n "$DISPLAY" ]; then
open_generic_xdg_x_scheme_handler "$1"
fi
# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
# some fallback
fi
open_envvar "$1"
exit_failure_operation_impossible "no method available for opening '$1'"
}To me this looks like that if the environment variable $BROWSER is set (which is in my case as per default installation), it will always resolve to open any protocol with the browser?
When I changed
if [ -n "$BROWSER" ]; thento
if [ -n "$BROWSER" ] && ! (echo "$1" | grep -q '^magnet:') ; thenxdg-open works correctly since it actually tries to find the scheme handler. Any thoughts?
Offline