Created
January 11, 2011 01:42
-
-
Save pol/773849 to your computer and use it in GitHub Desktop.
Set the background color of iTerm based on RAILS_ENV
This file contains hidden or 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
#!/usr/local/bin/bash | |
set_term_bgcolor(){ | |
local R=$1 | |
local G=$2 | |
local B=$3 | |
/usr/bin/osascript <<EOF | |
tell application "iTerm" | |
tell the current terminal | |
tell the current session | |
set background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))} | |
end tell | |
end tell | |
end tell | |
EOF | |
} | |
# | |
if [[ "$@" =~ production.server ]]; then | |
set_term_bgcolor 20 0 0 | |
elif [[ "$@" =~ staging.server ]]; then | |
set_term_bgcolor 0 20 0 | |
fi | |
ssh $@ | |
set_term_bgcolor 0 0 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing this.
Unfortunately, I found that your AppleScript doesn't work in iTerm2 Build 3.0.0.
I fixed the script like this and it's been working: