Blob


1 #!/bin/sh
3 plumbfirefox()
4 {
5 echo '
6 tell application "Firefox"
7 activate
8 tell application "System Events"
9 tell process "firefox"
10 keystroke "t" using {command down}
11 end tell
12 end tell
13 Get URL "'$1'"
14 end tell
15 ' | osascript
16 }
18 plumbsafari()
19 {
20 echo '
21 tell application "Safari"
22 activate
23 tell application "System Events"
24 tell process "safari"
25 keystroke "t" using {command down}
26 end tell
27 end tell
28 open location "'$1'"
29 end tell
30 ' | osascript
31 }
33 plumbapple()
34 {
35 case ${BROWSER:-none} in
36 firefox)
37 plumbfirefox "$@"
38 ;;
39 safari)
40 plumbsafari "$@"
41 ;;
42 none)
43 if [ -d /Applications/Firefox.app ]
44 then
45 plumbfirefox "$@"
46 else
47 plumbsafari "$@"
48 fi
49 ;;
50 esac
51 }
53 plumbunix()
54 {
55 case "${BROWSER:=firefox}" in
56 # Other browsers here
57 # ...
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 esac
73 }
75 plumb1()
76 {
77 case `uname` in
78 Darwin)
79 plumbapple "$@"
80 ;;
81 *)
82 plumbunix "$@"
83 ;;
84 esac
85 }
88 if [ $# = 0 ]
89 then
90 plumb1 about:blank
91 else
92 for i
93 do
94 if [ -f "$i" ]
95 then
96 p=`pwd`
97 i=`echo $i | sed 's/ /%20/g'`
98 i=`cleanname -d $p $i`
99 i=file://$i
100 else
101 i=`echo $i | tr -d ' '`
102 fi
103 plumb1 $i
104 done
105 fi
107 case $BROWSER in
108 *opera*)
109 $BROWSER -remote 'raise()'
110 esac