Send to Ghostty
Send selected command text to the active Ghostty terminal pane. Removes trailing newlines; review the selection and terminal before running.
By Adam Hart
Requires the next ActionClip app update. Not available in the current public 2.3.2 release. Download the action file, open it in ActionClip, then review it before choosing Add Action. Get ActionClip if you haven’t installed it yet.
What it does
Send a command from a guide, chat, or document to Ghostty without copying and switching apps manually. Activates Ghostty, opens a window if needed, and sends the selection to the focused terminal pane in its selected tab. Suggests the action for command-like text. Trailing newlines are removed, but internal line breaks and control characters remain: multiline input may execute commands depending on the shell or running program. Text may append to anything already at the prompt. Use an empty, idle prompt and review the selection first. Blank-line-only input currently produces an error.
How to use it
- Requires the next ActionClip app update. Not available in the current public 2.3.2 release.
- Choose Download action and open the downloaded .actionclip file.
- Review the action and choose Add Action.
- Select the text you want to use and choose Send to Ghostty.
Requirements
Ghostty with AppleScript support, a compatible ActionClip version with reviewed Community actions, and macOS Automation permission for ActionClip to control Ghostty. Start with an empty, idle terminal prompt.
Privacy
The full selected text is sent locally to the active Ghostty terminal pane through AppleScript. This action makes no network request itself. A shell, remote session, or other program running in that pane may process, execute, record, or transmit the text.
Example
Input
echo ACTIONCLIP_GHOSTTY_TESTOutput
Ghostty receives echo ACTIONCLIP_GHOSTTY_TEST in its focused terminal pane. At an empty shell prompt, review the text before pressing Return.View action source
-- 1. Grab the highlighted text using ActionClip's native token
set theCommand to "{{selected_text}}"
-- 2. Strip any trailing newlines so the command DOES NOT auto-execute!
repeat while theCommand ends with return or theCommand ends with linefeed
set theCommand to text 1 thru -2 of theCommand
end repeat
-- 3. Target Ghostty
tell application "Ghostty"
activate
-- Check if a Ghostty window already exists; if not, spin up a new one
if not (exists front window) then
set win to new window
else
set win to front window
end if
-- Target the currently active terminal pane
set currentTerm to focused terminal of selected tab of win
-- Native Ghostty command to paste text securely
input text theCommand to currentTerm
end tell