Re: [dev][project] soap - a simple xdg-open replacement

From: Dmitrij D. Czarkoff <czarkoff_AT_gmail.com>
Date: Thu, 8 May 2014 10:37:39 +0200

FRIGN said:
> > I did not investigate issue in detail, but apparently xdg-open treats
> > all http links as "text/html". "xdg-open http:" starts Firefox.
>
> Yes, that's the problem. That's why I wrote soap in the first place.

But this is easy to work around with a shell script. Having something
like "http-helper.sh" below, you may make a simple .desktop file and:

        $ xdg-mime default http-helper.desktop text/html

It is more consistent with a model, doesn't break package manager (you
have xdg-utils in dependecies for software, don't you?) and is easier to
fine-tune.


> Well, if you edit your .mailcap frequently, why not just alias a
> command like
>
> editsoap = vim /path/to/soap/config.h && make clean && make install
>
> to provide the same functionality?

Obviously, this is the way to work around the issue. Still, moving
configuration of program X to configuration file of program Y feels like
bad taste to me.


-- 
Dmitrij D. Czarkoff
------------------------------------------------------------------------
  http-helper.sh:
------------------------------------------------------------------------
#!/bin/sh
MIME=`curl -I --max-redirs -1 -s "$_AT_" | sed -Ee '/Content-Type/!d' -e 's/.+: ([^;]+)(;.*)?/\1/'`
if [ "$MIME" == "text/html" -o "x$MIME" == "x" ]
then
	$BROWSER "$_AT_"
else
	file=`mktemp -p "${TMP:-/tmp}" xdgXXXXXX`
	curl -s "$_AT_" > $file
	xdg-open $file
	rm $file
fi
Received on Thu May 08 2014 - 10:37:39 CEST

This archive was generated by hypermail 2.3.0 : Fri May 09 2014 - 00:12:15 CEST