updated on Fri Jan 6 04:00:21 UTC 2012
[aur-mirror.git] / mc-suse / x11_browser
blob87bdecf90d6360d3bf97470ff175362380e96b41
1 #!/bin/bash
3 # Call appropriate brower
5 # Copyright (c) 2001 Philipp Thomas <pthomas@suse.de>
7 # Borrowed heavily from url_handler.sh by Werner Fink <werner@suse.de>
10 url="$1"
11 method="${1%%:*}"
13 if test "$url" = "$method" ; then
14 case "${url}" in
15 */*.htm|*/*.html) method=http ;;
16 */*.htmls) method=https ;;
17 /*) if test -r "${url}" ; then
18 method=file
19 fi ;;
20 *) if test -r "$PWD/${url}" ; then
21 method=file
22 url="$PWD/${url}"
23 fi ;;
24 esac
26 case "$method" in
27 file) url="${method}:$url" ;;
28 *) url="${method}://$url" ;;
29 esac
32 shift
34 case "$method" in
35 file|http|https)
36 http=
37 type -p lynx >& /dev/null && http=lynx
38 type -p links >& /dev/null && http=links
39 type -p w3m >& /dev/null && http=w3m
40 test -n "$DISPLAY" && type -p netscape >& /dev/null && http=netscape
41 test -n "$DISPLAY" && type -p Netscape >& /dev/null && http=Netscape
42 test -n "$DISPLAY" && type -p opera >& /dev/null && http=opera
43 test -n "$DISPLAY" && type -p mozilla >& /dev/null && http=mozilla
44 case "$http" in
45 [nN]etscape|opera|mozilla) ($http -remote "openURL($url)" || $http "$url") >/dev/null 2>&1 & ;;
46 lynx|w3m|links) exec $http "$url" ;;
48 echo "No HTTP browser found."
49 read -p "Press return to continue: "
50 exit 0 # No error return
52 esac
55 echo "URL type \"$method\" not known"
56 read -p "Press return to continue: "
57 exit 0 # No error return
59 esac