Skip to content
QuantumFrost edited this page Aug 31, 2024 · 2 revisions

Custom Alfred WezTerm Script

AppleScript for WezTerm Alfred integration. Inspired by Vitorgalvao's script for iTerm.

Preview

Aug-31-2024 14-38-20

Setup

  1. Copy the script to your clipboard (see below).
  2. Open Alfred Preferences (call Alfred and press ⌘,).
  3. Navigate to Features → Terminal → Custom.
  4. Set Application to Custom.
  5. Select the text in the box.
  6. Paste the script.
  7. Launch Alfred.
  8. Start with a > and type your command.
  9. Press Enter.
  10. It will open WezTerm and execute your command in a new tab.

Script

on alfred_script(query)
	tell application "wezterm" to activate
	set paneId to do shell script "/Applications/WezTerm.app/Contents/MacOS/wezterm cli spawn"
	set commandList to paragraphs of query
	repeat with command in commandList
		do shell script "echo " & command & " | /Applications/WezTerm.app/Contents/MacOS/wezterm cli send-text --no-paste --pane-id " & paneId
	end repeat
end alfred_script
Clone this wiki locally