Skip to content

Instantly share code, notes, and snippets.

@wirsich
Forked from reyjrar/New-iTerm-Window.scpt
Created August 19, 2022 09:32
Show Gist options
  • Select an option

  • Save wirsich/e50e856c42f64ddedaab2612c35477ee to your computer and use it in GitHub Desktop.

Select an option

Save wirsich/e50e856c42f64ddedaab2612c35477ee to your computer and use it in GitHub Desktop.
AppleScript to Open a New iTerm Window and bring it to the front
(*
* New-iTerm-Window.scpt
*
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
*
* Based on much Googling - very little "original" code here
* Comments/Suggestions to brad.lhotsky@gmail.com
*)
if isAppRunning("iTerm") then
tell application "iTerm"
set myterm to (make new terminal)
tell myterm
set mysession to (make new session at the end of sessions)
tell mysession
exec command "/bin/bash -l"
end tell
end tell
activate
end tell
else
activate application "iTerm"
end if
(* Code from Dweller on
* http://codesnippets.joyent.com/posts/show/1124
*)
on isAppRunning(appName)
tell application "System Events" to (name of processes) contains appName
end isAppRunning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment