GNU screen split: how to show active pane in caption

I am using GNU screen with a horizontal split, but it is not always easy to decide which pane is active (e.g. when using a program like top in one of the panes). Is it possible to change the color of the text in the caption, when the pane is active?

I use these settings right now:

hardstatus alwayslastline "%{= G}%{g}[ %{G}%H %{g}][ %?%-Lw%?%{R} %n*%f %t %{g}%?%+Lw%? %{g}]%=%{g}[ %{W}%c:%s %{g}]"
caption splitonly "%{= g}[%n %t]"

It would be nice to be able to change the color of %n %t to R when the pane is active, or some other way of highlighting the pane.

Asked By: fbence


I looked at the STRING ESCAPES section of the screen man page and found what you may be after. The ? escape is like an if statement and the : escape is like an else statement. The F escape is true when that window has the focus. So the if-then-else statement for the if active then, else would look like this (padding added for readability):

%? %F active-window options %: inactive-window-options %?

The original option was %{= g} (pad string to display width and green) changing the active screen text to bright red will look like this:

caption splitonly "%?%F%{= R}%:%{= g}%?[%n %t]"

Answered By: Lee
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.