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 ;;
67 x-)
68 BROWSER=firefox
69 $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 esac
78 }
80 plumb1()
81 {
82 case `uname` in
83 Darwin)
84 plumbapple "$@"
85 ;;
86 *)
87 plumbunix "$@"
88 ;;
89 esac
90 }
93 if [ $# = 0 ]
94 then
95 plumb1 about:blank
96 else
97 for i
98 do
99 if [ -f "$i" ]
100 then
101 p=`pwd`
102 i=`cleanname -d $p $i`
103 i=file://$i
104 fi
105 plumb1 $i
106 done
107 fi
109 case $BROWSER in
110 *opera*)
111 $BROWSER -remote 'raise()'
112 esac