![]()
iTerm
Set as the Custom Terminal
1) Go into Alfred’s preferences at: Features > Terminal
2) Set Application’s drop-down menu to Custom
3) Insert this script into the text input area:
-- Guillaume Barrette
-- 2019-05-04
on alfred_script(q)
tell application "iTerm"
activate
tell current window
try
if is hotkey window then reveal hotkey window
create tab with default profile
on error
create window with default profile
end try
tell current session to write text q
end tell
end tell
end alfred_script
*Note
As reference, I was using this script, before building my own. I found some problems while using it and decided to create my own version that better work with my workflow. However, I thought I would tell it here in case this other script better work for you.
Hyper
I’m not using this Terminal application, but I’ve helped some people to make it work for them on the Alfred Forum. I’m leaving this here in case this is useful to someone else.
To use it, just do the same as above with the iTerm terminal, but replace the script with this one:
-- Guillaume Barrette
-- 2017-06-30
on alfred_script(q)
if (text 1 thru 2 of q) is equal to "cd" then
do shell script "open -a Hyper " & text 4 thru -1 of q
else
do shell script "open -a Hyper ~"
set appRead to false
set nbrOfTry to 0
delay 0.5
repeat
try
tell application "System Events"
set appRead to true
if exists (window 1 of process "Hyper") then exit repeat
end tell
end try
set nbrOfTry to nbrOfTry + 1
if nbrOfTry = 20 then exit repeat
delay 0.5
end repeat
if appRead then tell application "System Events" to keystroke q & return
end if
end alfred_script