Browse code

Merge branch 'osx' of https://github.com/benlangfeld/oh-my-zsh into benlangfeld-osx

Robby Russell authored on 22/02/2011 at 05:55:27
Showing 1 changed files
... ...
@@ -1,11 +1,57 @@
1
+function savepath() {
2
+  pwd > ~/.current_path~
3
+}
4
+
1 5
 function tab() {
2
-  osascript 2>/dev/null <<EOF
6
+savepath
7
+osascript >/dev/null <<EOF
8
+on do_submenu(app_name, menu_name, menu_item, submenu_item)
9
+    -- bring the target application to the front
10
+    tell application app_name
11
+      activate
12
+    end tell
3 13
     tell application "System Events"
4
-      tell process "Terminal" to keystroke "t" using command down
5
-    end
6
-    tell application "Terminal"
14
+      tell process app_name
15
+        tell menu bar 1
16
+          tell menu bar item menu_name
17
+            tell menu menu_name
18
+              tell menu item menu_item
19
+                tell menu menu_item
20
+                  click menu item submenu_item
21
+                end tell
22
+              end tell
23
+            end tell
24
+          end tell
25
+        end tell
26
+      end tell
27
+    end tell
28
+end do_submenu
29
+
30
+do_submenu("Terminal", "Shell", "New Tab", 1)
31
+EOF
32
+}
33
+
34
+function itab() {
35
+savepath
36
+osascript >/dev/null <<EOF
37
+on do_submenu(app_name, menu_name, menu_item)
38
+    -- bring the target application to the front
39
+    tell application app_name
7 40
       activate
8
-      do script with command "cd \"$PWD\"; $*" in window 1
9 41
     end tell
42
+    tell application "System Events"
43
+      tell process app_name
44
+        tell menu bar 1
45
+          tell menu bar item menu_name
46
+            tell menu menu_name
47
+              click menu item menu_item
48
+            end tell
49
+          end tell
50
+        end tell
51
+      end tell
52
+    end tell
53
+end do_submenu
54
+
55
+do_submenu("iTerm", "Shell", "New Tab")
10 56
 EOF
11
-}
12 57
\ No newline at end of file
58
+}