-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwork.applescript
36 lines (32 loc) · 888 Bytes
/
work.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
tell application "iTerm"
activate
-- Count number of terminal windows
set termcount to count of terminal
-- If there are no terminal windows open, create a new one
if termcount is 0 then
set term to (make new terminal)
else
set term to (terminal 0)
end if
tell term
-- Make a new session
launch session "terryma"
tell the last session
set name to "desktop"
write text "work"
end tell
launch session "terryma"
tell the last session
set name to "laptop"
write text "tmux kill-session"
write text "tmux attach -d"
delay 1
write text "t laptop"
end tell
-- Terminate first session
terminate session 0
-- Put it in the right place
tell i term application "System Events" to keystroke "l" using {command down, control down, shift down, option down}
tell i term application "System Events" to keystroke return
end tell
end tell