Created
September 27, 2022 16:51
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
Ah this is great. Thank you.
Hey, how do you use this? It isn't working in the custom terminal text area.
@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.
Thanks for this. I'm using it in the Terminal PopClip extension.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I would like to know if you have problem with Open Terminal Here (Universal Action) because I can not use it with Warp.