Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting terminal tab title #5700

Open
shiyuangu opened this Issue Dec 9, 2016 · 4 comments

Comments

Projects
None yet
5 participants
@shiyuangu
Copy link

shiyuangu commented Dec 9, 2016

Hi,
On Ubuntu 16.04(Xenial Xerius): I try to set the terminal tab title following this post:

print -Pn "\e]1;test_title\a"

which has actually no effect. I wonder whether this problem is caused by interference with oh-my-zsh. I notice that lib/termsupport.zsh does define a title() function which has no effect either:

title short_tab

Any help/suggestion on this is appreciated.

@heruan

This comment has been minimized.

Copy link

heruan commented Jun 6, 2017

Any news on this? I'm experiencing it too (tested on macOS Sierra Terminal and iTerm2).

@saurfangg

This comment has been minimized.

Copy link

saurfangg commented Jun 29, 2017

@shiyuangu You probably need to edit your ~/.zshrc file and uncomment the following line:

DISABLE_AUTO_TITLE="true"

After that you can change a tab's title with something like:
echo -e "\033];this is the title\007"

@tareqalam

This comment has been minimized.

Copy link

tareqalam commented Jul 4, 2017

@shiyuangu solution works, just added a method inside .zshrc like this:

function set-title(){
  TITLE="\[\e]2;$*\a\]"
  echo -e ${TITLE}
}

then I can call the method in terminal like this:
set-title 'whatever i want'

@cameck

This comment has been minimized.

Copy link

cameck commented Jul 18, 2017

You can put right underneath the DISABLE_AUTO_TITLE="true" (as stated by @saurfangg) this:

function precmd () {
  window_title="\033]0;${PWD##*/}\007"
  echo -ne "$window_title"
}

That will set the tab to have the title of the current file directory and using the precmd will enable it to execute before each prompt.

Better yet, you should put this code in your own custom profile to keep things neat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.