Skip to content

Instantly share code, notes, and snippets.

@tunaranch
Created October 19, 2011 04:15
Show Gist options
  • Save tunaranch/1297464 to your computer and use it in GitHub Desktop.
Save tunaranch/1297464 to your computer and use it in GitHub Desktop.
Change terminal theme depending on where you're ssh-ing to
# 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