Skip to content

Commit 924561b

Browse files
author
Matt Turner
committed
Merge pull request #158 from mortonfox/no-window-new-tab
Handle situation where iTerm is running but has no windows. @mortonfox Thanks! I really like ```set curTerm to (current terminal)``` I'm going to merge the pull request but this got me thinking about the iTerm conditions we are handling. 1. iTerm is not open 2. iTerm app is running but no iTerm windows are open 3. iTerm app is running and we have iTerm windows open. I'm not handling #2 correctly. I'm going to completely rewrite this to verbosely handle all events. This will make the code easier to read and correctly handle what is going on. Thanks for taking the time to contribute.
2 parents 0aecaba + 0e53645 commit 924561b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
104 Bytes
Binary file not shown.

apple-scripts/iTermStable/iTerm-stable-new-tab-default.applescript

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ end scriptRun
1616
on CommandRun(withCmd, withTheme, theTitle)
1717
tell application "iTerm"
1818
if it is running then
19-
tell the current terminal
19+
set curTerm to (current terminal)
20+
try
21+
set tmp to curTerm
22+
on error
23+
set curTerm to (make new terminal)
24+
end try
25+
tell curTerm
2026
set newSession to (launch session withTheme)
2127
tell the last session
2228
reopen
@@ -41,4 +47,4 @@ on CommandRun(withCmd, withTheme, theTitle)
4147
end tell
4248
end if
4349
end tell
44-
end CommandRun
50+
end CommandRun

0 commit comments

Comments
 (0)