File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ property open_in_new_window : false
77-- Set this property to false to reuse current tab
88property open_in_new_tab : true
99
10+ -- Set this property to true if iTerm is configured to launch without opening a new window
11+ property iterm_opens_quietly : false
12+
1013-- Handlers
1114on new_window ()
1215 tell application " iTerm" to create window with default profile
@@ -54,20 +57,25 @@ on alfred_script(query)
5457 -- Reuse current tab
5558 end if
5659 else
57- -- If iTerm is not running and we tell it to create a new window, we get two
58- -- One from opening the application, and the other from the command
59- if is_running() then
60+ -- If iTerm is not running and we tell it to create a new window, we get two:
61+ -- one from opening the application, and the other from the command
62+ if is_running() or iterm_opens_quietly then
6063 new_window()
6164 else
6265 call_forward()
6366 end if
6467 end if
6568
6669 -- Make sure a window exists before we continue, or the write may fail
67- repeat until has_windows()
70+ -- "with timeout" does not work with a "repeat"
71+ -- Delay of 0.01 seconds repeated 500 times means a timeout of 5 seconds
72+ repeat 500 times
73+ if has_windows() then
74+ send_text(query)
75+ call_forward()
76+ exit repeat
77+ end if
78+
6879 delay 0.01
6980 end repeat
70-
71- send_text(query)
72- call_forward()
7381end alfred_script
You can’t perform that action at this time.
0 commit comments