How to supress date/time display in GNU Screen vertical splits

gnu-screenterminalterminal-emulatorunix

I am using a copy of GNU Screen packaged for Fedora 18.

I copied these neat lines over onto my .screenrc, to show me the host/date-time/windows:

# Neat status bar on the bottom of the screen
caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
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}]'

Occasionally, I fire up a vertical split (Ctrl a - |), and this causes another status bar stacked on top of the window status bar I've got. This new status bar shows the date-time/window-name/window-number for each split. Now the date-time is a useless distraction. I would rather just see the window identification and nothing else for each vertical split.

How can I supress display of the date-time on the vertical split statuses?

If you want to see what I mean, here is a screenshot. Look at line#2 from the bottom of the screen:

A screenshot of GNU Screen running two vertical splits

Best Answer

That's what you get for copying neat lines instead of understanding them, especially because these already look like quite the catastrophic result of too much copying...

  • hardstatus alwayslastline
    This means that you want the line defined as "hardstatus" to always be displayed, and you want it to fill the last line of your terminal.

  • hardstatus string <stuff>
    This means you're defining what the "hardstatus" line should look like. For details, read the String Escapes explanation; I'll start you off:

    • %{= kG} The colour (${}) is set (=) to black back- and light green foreground (kG)
    • [_ a literal square bracket and space are printed,
    • %{G}%H_ the colour (%{}) is again(!?) set to light green foreground (G), then the current hostname is printed (%H), followed by a literal space
    • %{g}][ the colour (%{}) is set to dark green foreground (g), followed by close-bracket and open-bracket
    • %=_ elastic padding, followed by a literal space (this guarantees at least one space)
    • %{= kw} the colour (%{}) is set (=) to white-on-black (kw)
    • %?%-Lw%? this one's interesting, needs to be read inside-out: the list of window names (%w), if applicable with flags (L), but only for window numbers less than the current one (-); this list is only printed if there is a non-empty expansion (%?..%? for "if" and "endif"), which makes no sense here, because there's nothing besides the single exansion, which is otherwise empty anyway.
    • %{r} change the colour (%{}) to red foreground (r)

    ... and so on, you get the idea. It contains multiple pointless elements, including the last conditional (which is both unnecessary and not explicitly closed).

    • caption string <stuff>
      This sets a special "caption", which will be displayed as the last line of every region. You can choose for this to be always displayed or just if you have splits (default) with caption always or caption splitonly; you cannot disable it, but you can set it to an empty string. I'll call out the initial conditional, which is useful:
    • %?%F%{= Bk}%?
      The %F means "do this if the current region is active, even if no escape sequence expands to printable characters". The %{= Bk} sets the color to black ("k") on light blue.

Anyway. What you want to do is change that caption; you say you only want "the window identification for each vertical split"; I'll assume you're fine with the colour highlighting. I'd use these, all fixed up:

hardstatus alwayslastline '%{= kG}[ %H ]%{g}[%= %{w}%-Lw%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%+Lw%= %{g}]%{G}[%{B} %d/%m %{W}%c %{G}]'
caption splitonly '%?%F%{= BW}%:%{= kg}%? %t %='
Related Question