how to dynamically STOP changing the tab title?

1,225 views
Skip to first unread message

Shiyao Ma

unread,
Jun 30, 2015, 1:37:35 PM6/30/15
to iterm2-...@googlegroups.com
Hi,

I am using autossh. After running autossh, iterm2 tab title will become "autossh".

I'd like to wrap the autossh invocation into a shell script and before the invocation of autossh, I'd like to use some control sequence to tell iterm2 to disable tab name changing.

I am aware one can use echo -ne "\e]1;YOUR_TITLE\a" to change the title. But is there a way to stop changing the title?

Thanks.

Shiyao

Shiyao Ma

unread,
Jun 30, 2015, 2:32:38 PM6/30/15
to iterm2-...@googlegroups.com
There are some misunderstanding in my previous mail.

It turns out, the "autossh" in the tab is the "job name". And the "echo -ne "\e]1;YOUR_TITLE\a"" changes the window name.

iTerm2 will form the whole name in the form of "window_name(job_name)".

My problem is, how to use shell to change the job name? Is it possible?

George Nachman

unread,
Jun 30, 2015, 2:56:37 PM6/30/15
to iterm2-...@googlegroups.com
You can ask it not to show job names (Prefs>Appearance>Show current job name) or you can prevent the server from changing the title (Prefs>Profiles>Terminal>Terminal may set tab/window title), but there is no way to restrict it to just tab titles or for the shell to set the job name. This could be a good fit for shell integration though. Would you mind filing a feature request at iterm2.com/bugs?

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shiyao Ma

unread,
Jun 30, 2015, 3:05:40 PM6/30/15
to iterm2-...@googlegroups.com
Sure. Will do that later.

BTW, do you know how to clear the window title?

After "echo -ne "\e]1;YOUR_TITLE\a", the title will be YOUR_TITLE(zsh).

Then I want to clear it, so I do a "echo -ne "\e]1;\a", now it becomes (zsh).

The paren is still there.

George Nachman

unread,
Jun 30, 2015, 3:09:26 PM6/30/15
to iterm2-...@googlegroups.com
It's a gross little hack, but you can set it back to the profile name.

I really need to redo how titles work.

Trevor Sayre

unread,
Mar 8, 2016, 1:46:52 PM3/8/16
to iterm2-discuss
And is there a way to get the current profile name? I use multiple profiles and my precmd() would need to know the current profile name if your "little hack" is to work. Otherwise it would certainly be nice to have a way to release control of the tab title back to iTerm.

George Nachman

unread,
Mar 11, 2016, 2:10:31 AM3/11/16
to iterm2-...@googlegroups.com
The ITERM_PROFILE environment var has the name of the profile.

Trevor Sayre

unread,
Mar 14, 2016, 8:52:41 AM3/14/16
to iterm2-discuss, gnac...@llamas.org
Great thank you.

This logic works for me:

function init() {
  vcs_info
  if [[ -n $vcs_info_msg_1_ ]]; then
    echo -ne "\e]0;${vcs_info_msg_1_}\007";
  else
    echo -ne "\e]0;${ITERM_PROFILE}\007"
  fi
}

When the tab title is set to $ITERM_PROFILE, the parentheses go away and it seems to act like the reset we were requesting. Thank you for the hack.
Reply all
Reply to author
Forward
0 new messages