Comment 14 for bug 338722

Revision history for this message
Martin Meredith (mez) wrote :

I can change the terminal's title manually by running..

                print -Pn "\e]0;%n@%m: %~\a"

Which gets the terminals title how I want it to be, however, it doesn't track things as I go along.

Using Zsh's preexec and precmd, I can get it to change the title of the screen's window, but for some reason, the same command doesn't change the title of the window (only if I run it manually from the shell)

precmd () {
        case $TERM in
        screen-bce|screen)
                print -Pn "\e]0;%n@%m: %~\a"
                print -Pn "\ekzsh: %~\e\\"
                ;;
        xterm*|rxvt)
                print -Pn "\e]0;%n@%m: %~\a"
                ;;
        esac
}

preexec () {
        case $TERM in
        screen-bce|screen)
                print -Pn "\e]0;%n@%m: $1\a"
                print -Pn "\ek$1\e\\"
                ;;
        xterm*|rxvt)
                print -Pn "\e]0;%n@%m: $1\a"
                ;;
        esac

}