Skip to content

Instantly share code, notes, and snippets.

@mattmacleod
Created September 16, 2015 14:00
Show Gist options
  • Save mattmacleod/250ea789e138ce83b82c to your computer and use it in GitHub Desktop.
Save mattmacleod/250ea789e138ce83b82c to your computer and use it in GitHub Desktop.
function set_iterm2_background_color() {
/usr/bin/osascript <<EOF
tell application "iTerm"
tell the current terminal
tell the current session
set background color to $@
end tell
end tell
end tell
EOF
}
function get_iterm2_background_color() {
/usr/bin/osascript <<EOF
tell application "iTerm"
tell the current terminal
tell the current session
get background color
end tell
end tell
end tell
EOF
}
launch_ssh_with_colors() {
OLD_ITERM_BACKGROUND_COLOR="{$(get_iterm2_background_color)}"
set_iterm2_background_color {32000, 0, 0}
ssh $@
set_iterm2_background_color $OLD_ITERM_BACKGROUND_COLOR
}
alias ssh=launch_ssh_with_colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment