Page 1 of 1

Improving xdg-open

Posted: Wed 29 Mar 2017, 14:59
by Argolance
Bonjour,
Running Dropbox (but this may be true for many other applications!) I was getting this error message when the menu entry of the system icon "Run the Dropbox web site" was clicked:
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope"><env:Body xmlns:rox="http://rox.sourceforge.net/SOAP/ROX-Filer"><env:Fault xmlns:rpc="http://www.w3.org/2001/12/soap-rpc" xmlns:env="http://www.w3.org/2001/12/soap-envelope ... 2b87a65332 not found</faultstring></env:Fault></env:Body></env:Envelope>
jamesbond found a solution to this issue while modifying/adding lines into Jemimah's xdg-open.
Choice A:

Code: Select all

 #!/bin/bash
#this script created by Jemimah. see: http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150
#110115 xdg-open used to be a symlink to defaulthandler.

case "$1" in
        '') exit
                ;;
        *://*) exec rox -U "${1%#*}"
                ;;
        *@*.*) exec rox -U "mailto:${1}"
                ;;
        *) exec rox "$1"
                ;;
esac
Choice B:

Code: Select all

#!/bin/bash
#this script created by Jemimah. see: http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150
#110115 xdg-open used to be a symlink to defaulthandler.

case "$1" in
        '') exit
                ;;
        *://*) exec $DEFAULTBROWSER "$1"
                ;;
        *@*.*) exec rox -U "mailto:${1}"
                ;;
        *) exec rox "$1"
                ;;
esac
NOTE: $DEFAULTBROWSER, or /usr/local/bin/defaultbrowser, or defaulthandler, etc, may be chosen, whichever works best for many puplets.

While I'm at it:
In the original Woof-CE Jemimah's script (https://github.com/puppylinux-woof-CE/w ... n/xdg-open) it seems there is an anomaly:
#!/bin/sh
#this script created by Jemimah. see: http://murga-linux.com/puppy/viewtopic. ... &start=150
#110115 xdg-open used to be a symlink to defaulthandler.

#!/bin/bash

[...]
Cordialement.

Posted: Wed 29 Mar 2017, 18:07
by musher0
Bonjour, Argolance.

I am unclear about the type of feedback you wish to have on the above?

TIA. BFN.

Posted: Thu 30 Mar 2017, 01:44
by drunkjedi
I played with xdg-open once.
Here http://www.murga-linux.com/puppy/viewtopic.php?t=101776
It was just for opening .magnet files in transmission.

The xdg-open in puppy is simple, in fatdog it's slightly bigger, in Ubuntu it went all over my head (some 600 lines of scripting).

But I think you can take a look at Fatdog's script.

Posted: Thu 30 Mar 2017, 06:15
by jamesbond
While working together with Argolance to troubleshoot his dropbox app (see here: http://www.murga-linux.com/puppy/viewto ... 095#948095), we found that dropbox use xdg-open to launch its URL; and Puppy version of xdg-open fails to open a URL with the pattern "file:///some/local/file.html#anchor" (note that "file:///some/local/file.html" works, but "file:///some/local/file.html#anchor").

We traced the problem to the fact that xdg-open uses Rox to do open the URL; and Rox does not support anchors, so xdg-open fails.

The solution posted above is to improve the situation and make xdg-open able to open a local file with anchors. It's basically either:
a) drop the anchor, before passing the URL, or
b) Use $DEFAULTBROWSER to handle URL, instead of Rox.

The xdg-open in Woof-CE is old, and perhaps its time to be revisited. Hence this suggestion.

Posted: Thu 30 Mar 2017, 14:05
by musher0
Hello JamesBond, Argolance and all.

On my Puppy, < echo $DEFAULTBROWSER > refers to nothing useful
("exec", actually).

So I think I'll use < defaultbrowser > instead. I can, no?

The 2nd crunch-bang line < #!/bin/bash > is probably a leftover of
something else or an oversight, and can be safely removed.

IHTH. BFN.

Posted: Fri 31 Mar 2017, 08:26
by Argolance
Bonjour,
Thank you jamesbond for giving precisions about the reason of this thread. You did it better than I ever could!
Sorry musher0, I was busy this week and in a hurry: I admit it was a little bit "short"! :wink:
musher0 wrote:On my Puppy, < echo $DEFAULTBROWSER > refers to nothing useful
Not sure, but I think this is automatically updated when any installed browser is set as default browser using defaults-chooser.
So I think I'll use < defaultbrowser > instead. I can, no?
It is what I have done in the :arrow: MyDbox script
Now, Dropbox is fully functional! :D

Thanks drunkjedi for your note.

Cordialement.