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 am doing

ssh -t host screen -D -RR

in OS X (10.9) terminal tabs.

My ~/.screenrc is identical on all remote hosts and contain the following line:

hardstatus string "%H(%n:%t)$USER %h"

My ~/.bashrc is also identical on all hosts.

When I login to host host_u (Ubuntu 12.04.3 LTS) running Screen version 4.00.03jw4 (FAU) 2-May-06, the tab title on the OS X terminal is host_u(1:bash)sds ~, as expected.

When I login to host host_c (CentOS release 6.3 (Final)) running Screen version 4.00.03 (FAU) 23-Oct-06, the tab title on the OS X terminal is ~/FooBar (which is the local OS X directory from which I ran the ssh/screen command.

Problem: the hardstatus line does not work on host_c.

Additional information:

.screenrc:

termcapinfo xterm* ti@:te@

On both host_c and host_u, TERM is xterm-256color (inherited from the OS X terminal).

share|improve this question
    
I gave up on screen a few months ago and just bit the bullet and moved to tmux. No promises it'll fix this issue, but actively-maintained software almost always beats 7-year-old software. –  Darth Android Nov 8 '13 at 15:57
    
At a guess, the termcap/terminfo DB on host_c machine doesn't have the correct content. What's $TERM set to? Does tput ts && echo -n OMG && tput fs set the title correctly? Does your .screenrc contain any termcap/terminfo/termcapinfo lines? –  Gabe Nov 11 '13 at 22:04
    
@Gabe: tput ts --> tput: unknown terminfo capability 'ts' –  sds Nov 12 '13 at 14:30
    
OK, that's a bit weird. If you log in to host_c and can set the title with: 'echo -e "\033];TITLE GOES HERE\007"', try adding this line to your screenrc: "termcapinfo xterm* 'hs:ts=\E]2;:fs=\007'". I'll guess that it or something similar is present in /etc/screenrc (or /usr/local/etc/screenrc or whatever) on host_u. –  Gabe Nov 13 '13 at 3:14
    
@Gabe: yes, almost. adding termcapinfo xterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007' to host_c:~/.screenrc solved the problem. Please transform your comments into an answer and I will accept it. Thanks! –  sds Nov 13 '13 at 16:32

1 Answer 1

up vote 1 down vote accepted

To set the hardstatus, screen needs to know the correct escape codes to send to the terminal (emulator); they're found via termcap/terminfo. The relevant capabilities are:

  • hs - If set, the terminal supports a hardstatus line
  • ts - move the cursor to the hardstatus line ("begin")
  • fs - move the cursor back to where it was before ("finish")
  • ds - how to clear/reset the hardstatus ("default").

Nobody has a real "hardstatus" line any more. To use the title of an xterm or other GUI emulators, the capabilities need to be set; to avoid confusing programs, they're not set in the normal termcap/terminfo databases. You could add them there, or you can tell screen what they would be if they were set, in your .screenrc:

termcapinfo xterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007'
(This sets a default title of "screen", which is unlikely to be relevant. The actual escape codes may differ depending on your terminal emulator - in particular, for some xterm variants the 0 in \E]0; may not be required, or may need to be a different value; check your terminal emulator's man-page.)

These settings will be used by screen, but not be available to any other apps; e.g. if you had an editor that wanted to override the hardstatus, it would look up the real termcap, find hs unset (or whatever the system default is) and know not to do that.

share|improve this answer

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.