Skip to content

Instantly share code, notes, and snippets.

@parterburn
Created September 27, 2022 16:51
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save parterburn/e832b9090ee35eb830529de8bd978b82 to your computer and use it in GitHub Desktop.
Save parterburn/e832b9090ee35eb830529de8bd978b82 to your computer and use it in GitHub Desktop.
An easy way to use the Warp terminal (https://www.warp.dev/) with Alfred.
-- For the latest version:
-- https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82
-- Set this property to true to always open in a new window
property open_in_new_window : false
-- Set this property to false to reuse the current tab
property open_in_new_tab : true
-- Handlers
on new_window()
tell application "System Events"
tell process "Warp"
keystroke "n" using command down
end tell
end tell
end new_window
on new_tab()
tell application "System Events"
tell process "Warp"
keystroke "t" using command down
end tell
end tell
end new_tab
on call_forward()
tell application "Warp" to activate
end call_forward
on send_text(custom_text)
tell application "System Events"
tell process "Warp"
delay 0.5
keystroke custom_text
delay 0.5
key code 36
end tell
end tell
end send_text
-- Main
on alfred_script(query)
call_forward()
if open_in_new_window then
new_window()
else if open_in_new_tab then
new_tab()
else
-- Reuse the current tab
end if
call_forward()
send_text(query)
end alfred_script
@aalvan
Copy link

aalvan commented Jan 8, 2023

Hello, I would like to know if you have problem with Open Terminal Here (Universal Action) because I can not use it with Warp.

@jonzhan
Copy link

jonzhan commented Mar 16, 2023

Ah this is great. Thank you.

@benwaco
Copy link

benwaco commented May 26, 2023

Hey, how do you use this? It isn't working in the custom terminal text area.

@parterburn
Copy link
Author

@benwaco that’s where it worked for me. I’ve since switched to Raycast, so can’t comment if any updates might have broke this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment