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 $BROWSER "$i"67 ;;68 *mozilla*)69 $BROWSER -remote 'openURL('"$i"',new-tab)' ||70 $BROWSER "$i"71 ;;72 esac73 }75 plumb1()76 {77 case `uname` in78 Darwin)79 plumbapple "$@"80 ;;81 *)82 plumbunix "$@"83 ;;84 esac85 }88 if [ $# = 0 ]89 then90 plumb1 about:blank91 else92 for i93 do94 if [ -f "$i" ]95 then96 p=`pwd`97 i=`echo $i | sed 's/ /%20/g'`98 i=`cleanname -d $p $i`99 i=file://$i100 else101 i=`echo $i | tr -d ' '`102 fi103 plumb1 $i104 done105 fi107 case $BROWSER in108 *opera*)109 $BROWSER -remote 'raise()'110 esac