Created
December 26, 2010 04:48
-
-
Save ernix/755223 to your computer and use it in GitHub Desktop.
Set OSX terminal window background color per SSH hosts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#--------------------------------------------------------------------# | |
# Set OSX terminal window background color per SSH hosts. | |
#--------------------------------------------------------------------# | |
change_bgcolor () { | |
case $1 in | |
red) | |
osascript -e 'tell app "Terminal" to set background color of first window to {17655, 0, 0, -16373}';; | |
winered) | |
osascript -e 'tell app "Terminal" to set background color of first window to {10000, 0, 0, -16373}';; | |
green) | |
osascript -e 'tell app "Terminal" to set background color of first window to {0, 17655, 0, -16373}';; | |
blue) | |
osascript -e 'tell app "Terminal" to set background color of first window to {0, 0, 17655, -16373}';; | |
*) | |
osascript -e 'tell app "Terminal" to set background color of first window to {0, 0, 0, -16373}';; | |
esac | |
} | |
case $1 in | |
*foo.com) | |
color=red;; | |
*bar.com) | |
color=winered;; | |
*) | |
color=blue;; | |
esac | |
change_bgcolor $color | |
trap 'change_bgcolor' EXIT | |
ssh $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment