Created
November 6, 2014 10:36
-
-
Save xifengzhu/f5e2e03523b9c435bd06 to your computer and use it in GitHub Desktop.
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
# ~/.bash_profile | |
function cd { | |
# actually change the directory with all args passed to the function | |
builtin cd "$@" | |
auto_set_tab_chrome_background_color; | |
} | |
function auto_set_tab_chrome_background_color { | |
RR=`pwd | wc -m` | |
let RR=(RR%25)*10 | |
GG=`basename \`pwd\` | wc -m` | |
let GG=(GG%25)*10*2 | |
BB=`ls | wc -l` | |
let BB=(BB%25)*10 | |
# start to set background color of tab chrome | |
# Documents: http://iterm2.com/documentation-escape-codes.html | |
echo -en "\033]6;1;bg;red;brightness;${RR}\a" # -n: ignore newline | |
echo -en "\033]6;1;bg;green;brightness;${GG}\a" | |
echo -en "\033]6;1;bg;blue;brightness;${BB}\a" | |
} | |
auto_set_tab_chrome_background_color; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment