2004-03-02 23:11:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2005-01-11 19:23:52 +00:00
|
|
|
plumbfirefox()
|
|
|
|
{
|
|
|
|
echo '
|
|
|
|
tell application "Firefox"
|
|
|
|
activate
|
|
|
|
tell application "System Events"
|
|
|
|
tell process "firefox"
|
|
|
|
keystroke "t" using {command down}
|
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
Get URL "'$1'"
|
|
|
|
end tell
|
|
|
|
' | osascript
|
|
|
|
}
|
|
|
|
|
|
|
|
plumbsafari()
|
|
|
|
{
|
|
|
|
echo '
|
|
|
|
tell application "Safari"
|
|
|
|
activate
|
|
|
|
tell application "System Events"
|
|
|
|
tell process "safari"
|
|
|
|
keystroke "t" using {command down}
|
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
open location "'$1'"
|
|
|
|
end tell
|
|
|
|
' | osascript
|
|
|
|
}
|
|
|
|
|
|
|
|
plumbapple()
|
2004-03-02 23:11:58 +00:00
|
|
|
{
|
2005-01-11 19:23:52 +00:00
|
|
|
case ${BROWSER:-none} in
|
|
|
|
firefox)
|
|
|
|
plumbfirefox "$@"
|
|
|
|
;;
|
|
|
|
safari)
|
|
|
|
plumbsafari "$@"
|
|
|
|
;;
|
|
|
|
none)
|
|
|
|
if [ -d /Applications/Firefox.app ]
|
|
|
|
then
|
|
|
|
plumbfirefox "$@"
|
|
|
|
else
|
|
|
|
plumbsafari "$@"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
plumbunix()
|
|
|
|
{
|
|
|
|
case ${BROWSER:-firefox} in
|
2004-03-02 23:11:58 +00:00
|
|
|
# Other browsers here
|
|
|
|
# ...
|
|
|
|
*opera*)
|
2005-01-04 21:15:55 +00:00
|
|
|
$BROWSER -remote 'openURL('$i',new-page)'
|
2004-03-02 23:11:58 +00:00
|
|
|
;;
|
|
|
|
*firebird*)
|
2005-01-04 21:15:55 +00:00
|
|
|
$BROWSER -remote 'openURL('$i',new-window)'
|
2004-03-25 23:03:22 +00:00
|
|
|
;;
|
2004-03-21 04:32:36 +00:00
|
|
|
*firefox*)
|
2005-01-04 21:15:55 +00:00
|
|
|
$BROWSER -remote 'openURL('$i',new-tab)'
|
|
|
|
;;
|
|
|
|
x-)
|
2005-01-11 19:23:52 +00:00
|
|
|
BROWSER=firefox
|
|
|
|
$BROWSER -remote 'openURL('$i',new-tab)'
|
2004-03-02 23:11:58 +00:00
|
|
|
;;
|
2004-07-03 17:46:40 +00:00
|
|
|
*mozilla*)
|
2005-01-04 21:15:55 +00:00
|
|
|
$BROWSER -remote 'openURL('$i',new-tab)'
|
|
|
|
;;
|
|
|
|
x-*)
|
|
|
|
$BROWSER -remote 'openURL('$i',new-tab)'
|
2004-07-03 17:46:40 +00:00
|
|
|
;;
|
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
|
|
|
|
for i
|
|
|
|
do
|
|
|
|
if [ -f "$i" ]
|
|
|
|
then
|
2004-06-09 14:05:29 +00:00
|
|
|
p=`pwd`
|
|
|
|
i=`cleanname -d $p $i`
|
|
|
|
i=file://$i
|
2004-03-02 23:11:58 +00:00
|
|
|
fi
|
|
|
|
plumb1 $i
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $BROWSER in
|
|
|
|
*opera*)
|
|
|
|
$BROWSER -remote 'raise()'
|
|
|
|
esac
|
|
|
|
|