Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aalvan/f1f70b6c6d681d7b1dc67838a30a287e to your computer and use it in GitHub Desktop.
Save aalvan/f1f70b6c6d681d7b1dc67838a30a287e 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment