Comment 10 for bug 338722

Revision history for this message
Dominic Evans (oldmanuk) wrote :

I did some investigation on this earlier this morning and a .screenrc of

# special xterm hardstatus: use the window title.
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
# Red Hat's normal status line
hardstatus string "[screen %n%?: %t%?] %h"

with a tweak of .bashrc to set the PROMPT_COMMAND differently under screen

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
screen)
    PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}: ${PWD/$HOME/~}\033\\"'
    ;;
*)
    ;;
esac

emulates redhat's behaviour, basically telling screen that the terminal has its own hardstatus line in the form of its window title (termcapinfo setting), using a hardstatus string that contains %h for the current directory and using the PROMPT_COMMAND setting for screen in bashrc to keep this %h variable up to date when navigating within screen

However, as you can see, the way it works is to send all hardstatus information to the title. If you set 'alwayslastline' for the hardstatus, it is never sent to the terminal so the title remains as screen.

What we probably need is a patch for screen to allow two hardstatus lines to be set, one that is only ever sent to the terminal (that can be used as window title) and one that is only sent to screen (for when alwayslastline is set). That way screen-profiles can still continue to use the hardstatus for displaying status information etc. but we can still set the window title