File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ on has_windows()
2525end has_windows
2626
2727on send_text (custom_text )
28- -- iTerm may try to write text before a window exists, so wait for it
29- repeat until has_windows()
30- delay 0.1
31- end repeat
32-
3328 tell application " iTerm" to tell the first window to tell current session to write text custom_text
3429end send_text
3530
@@ -42,13 +37,20 @@ on alfred_script(query)
4237 new_tab()
4338 end if
4439 else
40+ -- If iTerm is not running and we tell it to create a new window, we get two
41+ -- One from opening the application, and the other from the command
4542 if is_running() then
4643 new_window()
4744 else
4845 call_forward()
4946 end if
5047 end if
51-
48+
49+ -- Make sure a window exists before we continue, or the write may fail
50+ repeat until has_windows()
51+ delay 0.01
52+ end repeat
53+
5254 send_text(query)
5355 call_forward()
5456end alfred_script
You can’t perform that action at this time.
0 commit comments