gEDA-dev: [PATCH] gschemdoc: Use xdg-open if available

Peter Clifton pcjc2 at cam.ac.uk
Wed Nov 28 09:57:44 EST 2007


On Wed, 2007-11-28 at 14:47 +0000, Peter TB Brett wrote:
> xdg-open is a tool from freedesktop.org which tries to use the user's
> preferred application to open a file or URL.  This is a big
> improvement over using a hardcoded list of applications to try.

Nice one (By visual review, I've not tested it).

There are also xdg-... utilities for installing icons, menus etc... I've
avoided them for now, as it seems they are far less common than just
dropping the icons in "the right place" (by some estimation of that
assertion), and running the gtk command to rebuild the icon cache. (Or
the mime-database update command etc..).

> ---
>  gschem/scripts/gschemdoc.sh |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/gschem/scripts/gschemdoc.sh b/gschem/scripts/gschemdoc.sh
> index acae51c..c4f9b62 100644
> --- a/gschem/scripts/gschemdoc.sh
> +++ b/gschem/scripts/gschemdoc.sh
> @@ -30,6 +30,13 @@ CANDIDATE_BROWSER="galeon mozilla phoenix netscape netscape-navigator opera fire
>  CANDIDATE_PDFREADER="xpdf acroread ggv gv"
>  CANDIDATE_LOCATE="slocate locate"
>  
> +# If xdg-open is available, use it
> +XDG_OPEN=`which xdg-open`
> +if test "$?" -ne "-1"; then
> +    CANDIDATE_BROWSER=$XDG_OPEN
> +    CANDIDATE_PDFREADER=$XDG_OPEN
> +fi
> +
>  # For OS X, since Linux has 'open' with different semantics
>  if [ "`uname -s`" = "Darwin" ]; then
>  	CANDIDATE_BROWSER="open $CANDIDATE_BROWSER"
-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



More information about the geda-dev mailing list