Improving xdg-open

What features/apps/bugfixes needed in a future Puppy
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

Improving xdg-open

#1 Post 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.
Last edited by Argolance on Thu 30 Mar 2017, 07:11, edited 1 time in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Bonjour, Argolance.

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

TIA. BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#3 Post 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.

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#4 Post 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.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post 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.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#6 Post 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.

Post Reply