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 would like screen to change the background color of the terminal (xterm) when started.

I want to have a quick way of determining whether I am in screen or not. I often work over shh and it often crashes. I started using screen so as not to lose my work. However, I do not want screen to start automatically when I ssh to the machine because I probably want to do screen -list or screen -r instead. Therefore, I need something to alert me that I am not in screen and that my work (especially running applications) can be lost if the connection dies.

I have xterm and I use ssh -XY, if that is relevant.

share|improve this question

migrated from stackoverflow.com Jun 7 '13 at 3:27

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

This doesn't change the background color, but I have a screenrc file which will put a status line at the bottom which makes it obvious when you're in screen:

As a gist: https://gist.github.com/cwacek/5724875

# Turn off that annoying start up message
startup_message off

# Turn the even more annoying whole-screen-flash-on-tab-complete "feature"
vbell off

terminfo xterm-color hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
term xterm-color

# Window list at the bottom. hostname, centered tabs and redmarked active windows:
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
share|improve this answer
    
Thanks, that seems to do the trick (and even more good things as well actually). The hardstatus string is complete black magic to me now, but it seems "man screen" provides all the necessary information to tweak it. –  rur Jun 6 '13 at 21:08
    
Yeah, I actually think that screenrc is one of the most useful things ever. I concede that I found it somewhere else, and didn't make it myself. –  Chris Jun 6 '13 at 21:10
    
^^ lol at "vbell" = "whole screen flash on tab complete" (vbell = visual bell, usefull if you don't have sound, and do want to receive those signals every so often... I agree that tab completion shouldn't give out one though ^^) –  Olivier Dulac Jun 6 '13 at 21:31
    
@OlivierDulac Well it also puts a little bell icon in the status line, which is arguably more helpful because you don't actually have to be looking at the right screen. –  Chris Jun 6 '13 at 21:32
    
That particular hardstatus line is pretty bad; I only just finished typing a long comment about it here: superuser.com/questions/600851/… - do take the time to understand what you're copying, your life will be much better for it. –  Gabe Nov 12 '13 at 0:19

Your Answer

 
discard

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