From ce3821962544cce0b255cf4b9e217279b424ce22 Mon Sep 17 00:00:00 2001 From: X Chen Date: Thu, 23 May 2024 03:31:30 -0400 Subject: [PATCH] Script for open a iterm window with a specific profile (#938) * Create iterm-open-profile-in-new-window.applescript * Update title/packageName --- ...erm-open-profile-in-new-window.applescript | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 commands/apps/iterm/iterm-open-profile-in-new-window.applescript diff --git a/commands/apps/iterm/iterm-open-profile-in-new-window.applescript b/commands/apps/iterm/iterm-open-profile-in-new-window.applescript new file mode 100644 index 000000000..6ef8fd3b7 --- /dev/null +++ b/commands/apps/iterm/iterm-open-profile-in-new-window.applescript @@ -0,0 +1,34 @@ +#!/usr/bin/osascript + +# Dependency: requires iTerm (https://iterm2.com) +# Install via Homebrew: `brew install --cask iterm2` + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Open profile +# @raycast.packageName iTerm +# @raycast.mode silent + +# Optional parameters: +# @raycast.icon 🤖 +# @raycast.argument1 { "type": "text", "placeholder": "Placeholder" } + +# Documentation: +# @raycast.author sunrisewestern +# @raycast.authorURL https://github.com/sunrisewestern + +on is_running(appName) + tell application "System Events" to (name of processes) contains appName +end is_running + +on run {argv} + set iTermRunning to is_running("iTerm2") + tell application "iTerm" + activate + if not (iTermRunning) then + delay 0.5 + close the current window + end if + create window with profile argv + end tell +end run