Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I don't know if I should ask it here or on unix.stackexchange.com, I found this question here.

My question is similar, I want to change the title of a terminal, I'm using a Debian based distro, Terminator and ZSH, oh-my-zsh the title was fine with bash, but when I moved to ZSH, it shows /bin/zsh as title.

share|improve this question
    
This is a duplicate of Change iTerm2 window and tab titles in zsh, iow you con use the technique described there. –  Daniël W. Crompton Aug 19 '13 at 22:55
    
@DaniëlW.Crompton really? it is a dupe? if so i'll close it right now, i linked to that question, so i know it is there, but didn't know it's a dupe because I'm using a different OS and emulator –  Fischer Aug 19 '13 at 22:57
    
Did you try out what was advised in the question you linked to? –  Daniël W. Crompton Aug 19 '13 at 22:59
    
@DaniëlW.Crompton yes, echo -ne "\e]1;this is the title\a and echo -ne "\e]1;$PWD\a" dont give errors but don't work, i tried unchecking all unless im missing something –  Fischer Aug 19 '13 at 23:10
1  
Did you try echo -ne "\e]0;$PWD\a" with a 0 rather than 1? –  Daniël W. Crompton Aug 19 '13 at 23:13
show 3 more comments

3 Answers

up vote 2 down vote accepted

You set your window title with the xtem escape sequences, in most implementations the first will work best:

echo -en "\e]0;string\a" #-- Set icon name and window title to string
echo -en "\e]1;string\a" #-- Set icon name to string
echo -en "\e]2;string\a" #-- Set window title to string

EDIT: The above only sets the title once. To set zsh to always display the sting in the title you add the following to your .zprofile in your home directory:

case $TERM in
    xterm*)
        precmd () {print -Pn "\e]0;string\a"}
        ;;
esac
share|improve this answer
    
i said earlier echo -ne "\e]0;$PWD\a" works but when i exit shell, it stops working... I tried you typed in the answer and i get zsh: command not found: stringa and zsh: command not found: e]1 and so on, all of them –  Fischer Aug 19 '13 at 23:52
    
Updated the answer –  Daniël W. Crompton Aug 20 '13 at 13:26
add comment

Well you can make a scrip that brings up a window and sets the name to be what you want. Execute the script to bring up the window with your name. You can also set the X,Y position and size of the window. You can make several and have windows named for every occasion.

share|improve this answer
add comment

This should work regardless of the shell used:

printf "\033];%s\07\n" "hello world"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.