Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Titlebar-handling with zsh and screen

BTW, for those who are interested, here's my current code for the
terminal title:

In .screenrc:

hardstatus off
hardstatus string "%h%n (%t)"
termcapinfo xterm*|rxvt hs:ts=\E]2;:fs=^G:ds=\E]2;TITLEDISABLED^G

In .zshrc:

zmodload -i zsh/parameter

  if [[ $psvar[1] -eq 0 ]] then
  elif [[ $psvar[1] -eq 1 ]] then
    psvar[1]="$psvar[1] job"
    psvar[1]="$psvar[1] jobs"
  [[ -n $TTY && $TERM == (xterm*|dtterm|rxvt|screen*) ]] &&
      print -nP "\e]1;%m:%.\x07"
      print -nP "\e]2;%(1v. %1v |.)${WINTITLE:+ $WINTITLE |} %n@%m - %~ | %y"
      [[ $TERM == screen* ]] && print -n .
      print -n "\x07"
    } > $TTY

TRAPCLD() { [[ -o interactive && -n $TTY ]] && precmd }

However, there's still a problem when a job terminates at the wrong
place. For instance:

$ sleep 5 &
$ screen

When the sleep terminates, the title will be (incorrectly) updated.
Moreover, I don't understand why the title doesn't come back to its
correct value when I hit the Return key.

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Messages sorted by: Reverse Date, Date, Thread, Author