plan9port/bin/web

80 lines
965 B
Text
Raw Permalink Normal View History

2004-03-02 23:11:58 +00:00
#!/bin/sh
2005-01-11 19:23:52 +00:00
plumbapple()
2004-03-02 23:11:58 +00:00
{
case ${BROWSER:-none} in
none)
open "$@"
;;
*google-chrome*)
open -a "Google Chrome" "$@"
;;
*)
open -a "$BROWSER" "$@"
;;
esac
2005-01-11 19:23:52 +00:00
}
plumbunix()
{
2005-05-07 22:32:03 +00:00
case "${BROWSER:=firefox}" in
2004-03-02 23:11:58 +00:00
# Other browsers here
# ...
*opera*)
2006-06-25 23:49:10 +00:00
$BROWSER -remote 'openURL('"$@"',new-page)'
2004-03-02 23:11:58 +00:00
;;
*firebird*)
2006-06-25 23:49:10 +00:00
$BROWSER -remote 'openURL('"$@"',new-window)'
2004-03-25 23:03:22 +00:00
;;
2004-03-21 04:32:36 +00:00
*firefox*)
$BROWSER --new-tab "$@" ||
2006-06-25 23:49:10 +00:00
$BROWSER "$@"
2004-03-02 23:11:58 +00:00
;;
2004-07-03 17:46:40 +00:00
*mozilla*)
2006-06-25 23:49:10 +00:00
$BROWSER -remote 'openURL('"$@"',new-tab)' ||
$BROWSER "$@"
2004-07-03 17:46:40 +00:00
;;
2018-11-14 05:03:17 +00:00
?*)
2009-12-27 17:19:39 +00:00
$BROWSER "$@"
;;
2004-03-02 23:11:58 +00:00
esac
}
2005-01-11 19:23:52 +00:00
plumb1()
{
case `uname` in
Darwin)
plumbapple "$@"
;;
*)
plumbunix "$@"
;;
esac
}
2004-03-02 23:11:58 +00:00
if [ $# = 0 ]
then
plumb1 about:blank
else
2006-06-25 23:49:10 +00:00
for i in "$@"
2004-03-02 23:11:58 +00:00
do
if [ -f "$i" ]
then
2006-06-25 23:49:10 +00:00
p=`pwd | sed 's/ /%20/g'`
2005-05-07 22:32:03 +00:00
i=`echo $i | sed 's/ /%20/g'`
2006-06-25 23:49:10 +00:00
i=`cleanname -d "$p" "$i"`
2004-06-09 14:05:29 +00:00
i=file://$i
2005-05-07 22:32:03 +00:00
else
i=`echo $i | tr -d ' '`
2004-03-02 23:11:58 +00:00
fi
plumb1 $i
done
fi
case $BROWSER in
*opera*)
$BROWSER -remote 'raise()'
esac