14

Let's say I have several shell "tabs" (or screens? sessions?) named bash1, bash2, etc. open in GNU screen. I want the status bar (i.e., the caption line) to display the names as "bash1 | bash2 | ..", with the currently open tab and the last open tab clearly marked.

How do I make this happen with my .screenrc?

  • I don't see anything in the screen manpage (at least for 4.00.02) that enumerates the previous window. Current window sure (%t) – Ricky Beam Feb 10 '14 at 7:07
19

Edit or create (if not present) /etc/screenrc or (~/.screenrc) and add below code

autodetach on 
startup_message off 
hardstatus alwayslastline 
shelltitle 'bash'

hardstatus string '%{gk}[%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}][%{d}%l%{g}][ %{= w}%Y/%m/%d %0C:%s%a%{g} ]%{W}'

shelltitle 'bash' can be changed once the screen is created. (Ctrla + A) session name can be changed to SESSSIONNAME with :sessionname SESSIONNAME.

  • Yup, that does it. Need to customize it a little though - I don't want to see time, etc. Will figure that out later. Thanks! – ARV Feb 10 '14 at 8:37
  • @ARV , yeah it can be customized by user. – GC 13 Feb 13 '14 at 9:29
  • This, without time etc: '%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}]' – Phlippie Bosman Jun 1 '17 at 11:30
0

The "tab" you are referring is Window (correct me if I'm wrong). You should try http://byobu.co/ which is a wrapper around screen and tmux.

I'm sure it comes with caption line, highlighting current window by default, but I don't remember there's ability to mark the last open window.

BUT seriously you should try tmux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.