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 plumbcamino()
34 {
35 echo '
36 tell application "Camino"
37 activate
38 tell application "System Events"
39 tell process "camino"
40 keystroke "t" using {command down}
41 end tell
42 end tell
43 Get URL "'$1'"
44 end tell
45 ' | osascript
46 }
48 plumbapple()
49 {
50 case ${BROWSER:-none} in
51 firefox)
52 plumbfirefox "$@"
53 ;;
54 safari)
55 plumbsafari "$@"
56 ;;
57 camino)
58 plumbcamino "$@"
59 ;;
60 none)
61 if [ -d /Applications/Camino.app ]
62 then
63 plumbcamino "$@"
64 elif [ -d /Applications/Firefox.app ]
65 then
66 plumbfirefox "$@"
67 else
68 plumbsafari "$@"
69 fi
70 ;;
71 esac
72 }
74 plumbunix()
75 {
76 case "${BROWSER:=firefox}" in
77 # Other browsers here
78 # ...
79 *opera*)
80 $BROWSER -remote 'openURL('"$@"',new-page)'
81 ;;
82 *firebird*)
83 $BROWSER -remote 'openURL('"$@"',new-window)'
84 ;;
85 *firefox*)
86 $BROWSER -remote 'openURL('"$@"',new-tab)' ||
87 $BROWSER "$@"
88 ;;
89 *mozilla*)
90 $BROWSER -remote 'openURL('"$@"',new-tab)' ||
91 $BROWSER "$@"
92 ;;
93 esac
94 }
96 plumb1()
97 {
98 case `uname` in
99 Darwin)
100 plumbapple "$@"
101 ;;
102 *)
103 plumbunix "$@"
104 ;;
105 esac
109 if [ $# = 0 ]
110 then
111 plumb1 about:blank
112 else
113 for i in "$@"
114 do
115 if [ -f "$i" ]
116 then
117 p=`pwd | sed 's/ /%20/g'`
118 i=`echo $i | sed 's/ /%20/g'`
119 i=`cleanname -d "$p" "$i"`
120 i=file://$i
121 else
122 i=`echo $i | tr -d ' '`
123 fi
124 echo p "$i"
125 plumb1 $i
126 done
127 fi
129 case $BROWSER in
130 *opera*)
131 $BROWSER -remote 'raise()'
132 esac