Blob
1 #!/bin/sh3 plumbfirefox()4 {5 echo '6 tell application "Firefox"7 activate8 tell application "System Events"9 tell process "firefox"10 keystroke "t" using {command down}11 end tell12 end tell13 Get URL "'$1'"14 end tell15 ' | osascript16 }18 plumbsafari()19 {20 echo '21 tell application "Safari"22 activate23 tell application "System Events"24 tell process "safari"25 keystroke "t" using {command down}26 end tell27 end tell28 open location "'$1'"29 end tell30 ' | osascript31 }33 plumbapple()34 {35 case ${BROWSER:-none} in36 firefox)37 plumbfirefox "$@"38 ;;39 safari)40 plumbsafari "$@"41 ;;42 none)43 if [ -d /Applications/Firefox.app ]44 then45 plumbfirefox "$@"46 else47 plumbsafari "$@"48 fi49 ;;50 esac51 }53 plumbunix()54 {55 case ${BROWSER:-firefox} in56 # Other browsers here57 # ...58 *opera*)59 $BROWSER -remote 'openURL('$i',new-page)'60 ;;61 *firebird*)62 $BROWSER -remote 'openURL('$i',new-window)'63 ;;64 *firefox*)65 $BROWSER -remote 'openURL('$i',new-tab)'66 ;;67 x-)68 BROWSER=firefox69 $BROWSER -remote 'openURL('$i',new-tab)'70 ;;71 *mozilla*)72 $BROWSER -remote 'openURL('$i',new-tab)'73 ;;74 x-*)75 $BROWSER -remote 'openURL('$i',new-tab)'76 ;;77 esac78 }80 plumb1()81 {82 case `uname` in83 Darwin)84 plumbapple "$@"85 ;;86 *)87 plumbunix "$@"88 ;;89 esac90 }93 if [ $# = 0 ]94 then95 plumb1 about:blank96 else97 for i98 do99 if [ -f "$i" ]100 then101 p=`pwd`102 i=`cleanname -d $p $i`103 i=file://$i104 fi105 plumb1 $i106 done107 fi109 case $BROWSER in110 *opera*)111 $BROWSER -remote 'raise()'112 esac