1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-07-01 02:59:50 +03:00

dsv/dsv: change viewer default from xpdf to xdg-open; introduce DSV_VIEWER; add README

This commit is contained in:
Werner Almesberger 2012-07-20 09:48:36 -03:00
parent e5e67dd597
commit 4a0b547b9a
2 changed files with 33 additions and 5 deletions

24
dsv/README Normal file
View File

@ -0,0 +1,24 @@
Setting the PDF viewer
----------------------
If the environment variable DSV_VIEWER is set, dsv will launch the
program specified there.
If DSV_VIEWER is not set but DSV_PDFVIEWER is set, dsv will launch
the program specified in DSV_PDFVIEWER.
If neither DSV_VIEWER nor DSV_PDFVIEWER are set, dsv will run
xdg-open to launch the viewer.
xdg-open typically defaults to the "evince" viewer. The default
can be changed from the command line with
xdg-mime default APPLICATION application/pdf
where APPLICATION is one of the *.desktop files typically found
in /usr/share/applications/ or /usr/local/share/applications/
For example, to make xpdf the default xdg-open (and hence many
other applications) uses, one would run
xdg-mime default xpdf.desktop application/pdf

14
dsv/dsv
View File

@ -2,8 +2,8 @@
# #
# dsv - Improved data sheet viewer # dsv - Improved data sheet viewer
# #
# Written 2010, 2011 by Werner Almesberger # Written 2010-2012 by Werner Almesberger
# Copyright 2010, 2011 Werner Almesberger # Copyright 2010-2012 Werner Almesberger
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -67,8 +67,12 @@ flush()
# @@@ should handle error # @@@ should handle error
else else
url=${url%`echo x"$inside" | sed 's/./?/g'`} url=${url%`echo x"$inside" | sed 's/./?/g'`}
wget -nv -O "$DSV_DIR/_tmp" "$url" zip=$nm-`basename "$url"`
unzip -p "$DSV_DIR/_tmp" "$inside" >"$DSV_DIR/$ds" || if [ ! -r "$DSV_DIR/$zip" ]; then
wget -nv -O "$DSV_DIR/$zip" "$url"
# @@@ should handle error
fi
unzip -p "$DSV_DIR/$zip" "$inside" >"$DSV_DIR/$ds" ||
{ rm -f "$DSV_DIR/$ds"; exit 1; } { rm -f "$DSV_DIR/$ds"; exit 1; }
fi fi
fi fi
@ -161,7 +165,7 @@ search()
if $path; then if $path; then
echo "`pwd`/$DSV_DIR/$file" echo "`pwd`/$DSV_DIR/$file"
else else
${DSV_PDFVIEWER:-xpdf} "$DSV_DIR/$file" ${DSV_VIEWER:-${DSV_PDFVIEWER:-xdg-open}} "$DSV_DIR/$file"
fi fi
exit exit
fi fi