Skip to content

Instantly share code, notes, and snippets.

@rfay
Created March 6, 2017 22:28
Show Gist options
  • Save rfay/fb043e166daa68270494c7b8b9c0b35a to your computer and use it in GitHub Desktop.
Save rfay/fb043e166daa68270494c7b8b9c0b35a to your computer and use it in GitHub Desktop.
iterm setup for changing your background in a particular place
The basics of iterm profile switching are here: https://www.iterm2.com/documentation-automatic-profile-switching.html
I used this config for ssh-based profile switching: https://www.evernote.com/l/AA9QPrDKFGFGRI_QrTfVcAwOQsTAmrxz8PEB/image.png
I did this in .bashrc/.zshrc to handle kubectl switches. This might be a little iffy depending on your actual config and how you manage it.
function iterm2_print_user_vars() {
export kube_context=$(kubectl config current-context 2>/dev/null)
iterm2_set_user_var kube_context $kube_context
if [ "$kube_context" = "drud-prod" ] ; then
echo -n "^[]1337;SetProfile=drud-prod^G"
else
echo -n "^[]1337;SetProfile=Default^G"
fi
}
Then you need to configure the profile for drud-prod - use background or colors to manage it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment