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

Peter TB Brett peter at peter-b.co.uk
Wed Nov 28 09:47:18 EST 2007


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.
---
 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"
-- 
1.5.3.3



More information about the geda-dev mailing list