On 19.08.2007 13:27 schrieb Alexander Sack - Debian Bugmail: > On Mon, Jul 23, 2007 at 12:00:12AM +0200, Bastian Venthur wrote: >> Package: icedove >> Version: 2.0.0.4.dfsg1-1 >> >> This just reminds me that xdg-utils (a very small package not depending >> on anything else and just consisting of a few scripts) provides a >> command "xdg-open". It calls the users preferred browser and works >> pretty well for reportbug-ng. >> >> Maybe icedove could check for the availability of this command and use >> it before it tries to open x-www-browser as last resort? > > Are there setups where xdg-open will not work?
I think it's very safe to use, since it will always call sensible-browser if everything else fails. Looking at the script it looks like it does the following: 1. Check if we're running KDE, GNOME or XFCE and call the appropriate url-handlers in this case (like kfmclient exec $1 for KDE). This means we're calling the *users* default browser here. 2. If not, try open_generic() (see below), which: 2.1. tries run-mailcap (whatever that does) or 2.2. as last resort calls sensible-browser which is provided by debianutils which is of priority required and should be available on every system. I'm not sure what the following bash snipped exactly does, but it should call sensible-browser as a last resort in every case. So yes, I think it is safe to use and much better than just calling sensible-browser without trying to find the users preference: ================================================================ open_generic() { if which run-mailcap >/dev/null && (echo "$1" | grep -q '^file://' || ! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then local file=$(echo "$1" | sed 's%^file://%%') run-mailcap --action=view "$file" else sensible-browser "$1" fi if [ $? -eq 0 ]; then exit_success else exit_failure_operation_failed fi } ================================================================ I'm using it in reportbug-ng for a while now and haven't heard of any problems so far. And since it is from freedesktop.org, I'm somewhat confident, that this is the "right" way to call a browser across different desktop-environments. Thanks for considering xdg-open, even if you decide not to use it. Cheers, Bastian. -- Bastian Venthur http://venthur.de Debian Developer venthur at debian org -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]