Created
October 19, 2011 04:15
-
-
Save tunaranch/1297464 to your computer and use it in GitHub Desktop.
Change terminal theme depending on where you're ssh-ing to
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
# Fix bug talked about at http://news.ycombinator.com/item?id=2418726 | |
# Tested on zsh. Paste the two following functions in your .zshrc. | |
# Customise the case switch to suit your own colour/host combos | |
function tabc { | |
osascript -e "tell application \"Terminal\" to set current settings of $1 to settings set \"$2\"" | |
} | |
function ssh { | |
local tabid; | |
tabid=$(osascript -e "tell application \"Terminal\" to get selected tab of front window") | |
case $1 in | |
*foo01*) | |
tabc $tabid "Ocean";; | |
*foo02*) | |
tabc $tabid "Grass";; | |
*) | |
tabc $tabid "Pro";; | |
esac | |
{ | |
/usr/bin/ssh -q "$@" | |
} always { | |
tabc $tabid "Novel" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment