Skip to content

Instantly share code, notes, and snippets.

@stefco
Forked from reyjrar/New-iTerm-Window.scpt
Created October 1, 2017 20:42
Show Gist options
  • Save stefco/4769e974ff324d8fe786b1b497e33aa3 to your computer and use it in GitHub Desktop.
Save stefco/4769e974ff324d8fe786b1b497e33aa3 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