Iterm2 tab and window titles remove current process information

itermzsh

I've found tons of places that describe how to get the window title and tab titles to reflect the current directory (relative to my home directory).

Here is what is in my .zshrc:

precmd() {
  # sets the tab title to current dir
  CURRENT=$(print -P %3~)
  echo -ne "\e]1;~/${CURRENT##*/}\a"
}

Works like a charm when I cd around. However, when I run a command– rails console, for example–that process name replaces the current directory information in both my window and tabs titles. This is unhelpful as I've got lots of tabs open, several in different directories (which represent different rails applications)and don't really care what process is running as much as where I am.

Is there a way to configure either iterm2 or zsh to NOT change the titles to the current process name?

thanks!

Best Answer

In my .zshrc I uncommented the line:

DISABLE_AUTO_TITLE="true"

This keeps the process from being put into the title because it's not changing the title automatically. The precmd function is called regardless of this setting so in there I change the titles manually.