Skip to content

Instantly share code, notes, and snippets.

@andrewdbate
Created October 17, 2023 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewdbate/7189e2d28a124183c84a05001d17c72c to your computer and use it in GitHub Desktop.
Save andrewdbate/7189e2d28a124183c84a05001d17c72c to your computer and use it in GitHub Desktop.
Script to use iTerm2 as the default terminal app from SmartGit.
#!/bin/bash
#
# To use iTerm2 as the default terminal from SmartGit, overwrite the file
# /Applications/SmartGit.app/Contents/Resources/open_terminal.sh
# with this file.
#
/usr/bin/osascript - $1 2>/dev/null << EOF
on run argv
set newpath to (do shell script "echo $PATH")
set path_cd to ""
repeat with n from 1 to count of argv
set path_cd to path_cd & item n of argv & ASCII character (92) & " "
end repeat
set path_cd to text 1 thru -3 of path_cd
tell application "iTerm"
activate
if (count of windows) is 0 then
if (count of windows) is 1 then
set newTab to (current tab of first window)
else
set newTab to (current tab of (create window with default profile))
end if
else
set newTab to (create tab with default profile) of first window
end if
end tell
end run
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment