mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
80 lines
1,022 B
Bash
Executable file
80 lines
1,022 B
Bash
Executable file
#!/bin/sh
|
|
|
|
plumbapple()
|
|
{
|
|
case ${BROWSER:-none} in
|
|
none)
|
|
open "$@"
|
|
;;
|
|
*google-chrome*)
|
|
open -a "Google Chrome" "$@"
|
|
;;
|
|
*)
|
|
open -a "$BROWSER" "$@"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
plumbunix()
|
|
{
|
|
case "${BROWSER:=firefox}" in
|
|
# Other browsers here
|
|
# ...
|
|
*opera*)
|
|
$BROWSER -remote 'openURL('"$@"',new-page)'
|
|
;;
|
|
*firebird*)
|
|
$BROWSER -remote 'openURL('"$@"',new-window)'
|
|
;;
|
|
*firefox*)
|
|
$BROWSER -remote 'openURL('"$@"',new-tab)' ||
|
|
$BROWSER "$@"
|
|
;;
|
|
*mozilla*)
|
|
$BROWSER -remote 'openURL('"$@"',new-tab)' ||
|
|
$BROWSER "$@"
|
|
;;
|
|
*google-chrome*|*chromium*)
|
|
$BROWSER "$@"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
plumb1()
|
|
{
|
|
case `uname` in
|
|
Darwin)
|
|
plumbapple "$@"
|
|
;;
|
|
*)
|
|
plumbunix "$@"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
|
|
if [ $# = 0 ]
|
|
then
|
|
plumb1 about:blank
|
|
else
|
|
for i in "$@"
|
|
do
|
|
if [ -f "$i" ]
|
|
then
|
|
p=`pwd | sed 's/ /%20/g'`
|
|
i=`echo $i | sed 's/ /%20/g'`
|
|
i=`cleanname -d "$p" "$i"`
|
|
i=file://$i
|
|
else
|
|
i=`echo $i | tr -d ' '`
|
|
fi
|
|
echo p "$i"
|
|
plumb1 $i
|
|
done
|
|
fi
|
|
|
|
case $BROWSER in
|
|
*opera*)
|
|
$BROWSER -remote 'raise()'
|
|
esac
|
|
|