Last active
January 18, 2025 10:05
-
-
Save maikschneider/371daba4a3003e9c5ff540fb5ec144af to your computer and use it in GitHub Desktop.
Set iTerm Tab Color & Name by Directory
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
| DISABLE_AUTO_TITLE="true" | |
| precmd() { | |
| case $PWD in | |
| *"git-project-1"*) | |
| TAB_NAME="Project 1" | |
| TAB_COLOR=(0 71 185) | |
| ;; | |
| *"git-project-2"*) | |
| TAB_NAME="Project 2" | |
| TAB_COLOR=(0 94 63) | |
| ;; | |
| *) | |
| TAB_NAME="${PWD##*/}" | |
| TAB_COLOR=(0 0 0) | |
| ;; | |
| esac | |
| echo -ne "\e]1;${TAB_NAME}\a" | |
| echo -ne "\e]6;1;bg;red;brightness;${TAB_COLOR[1]}\a" | |
| echo -ne "\e]6;1;bg;green;brightness;${TAB_COLOR[2]}\a" | |
| echo -ne "\e]6;1;bg;blue;brightness;${TAB_COLOR[3]}\a" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
