How to show in GNU Screen hardstatus what tab was selected previously?

9.7k views Asked by At

Every time I work in the console I use GNU Screen. I have a custom .screenrc file with several settings. Among others I have the setting that shows 'tabs' in the bottom:

hardstatus alwayslastline
hardstatus string "%{= g} %{= w}%-w%{=r}%n %t%{-}%+W"

It works well, but I want to add to the tabs some symbol that shows what tab was previously active. How can this be done?

2

There are 2 answers

1
Andrey Starodubtsev On

You can use can use following string:

hardstatus string "%{= g} %{= w}%-Lw%{=r}%n%f* %t%{-}%+LW"

Than window with focus will be marked with symbol '*' and previous one - with '-'.

1
Andrey Starodubtsev On

Alas, comments support only a bit of formatting abilities, so i created a new answer.

1) There is some '$' symbol after every tab number that are not needed

With hardstatus string "%{= g} %{= w}%-Lw%{=r}%n%f* %t%{-}%+LW" i can't see any '$':

enter image description here

2) the symbols '' and '-' make the tab one symbol wider and because of that the tabs jumps a little. I think it can be solved by placing space if there is no '' and '-' symbols.

Alas, all tabs besides selected are not configured - they are just shown if %w ( all windows including current ) or %W ( all windows except current ) are used in hardstatus string. These escapes can be prepended with - or + ( to show windows before or after current one ) and L ( to show window's flags ). Spaces, or formatting, or content of these parts of line can't be configured - they have only tab's number, title and optionally flags with fixed indents.

3) The symbol '*' is not needed because there is also a color selection of the current tab.

Sure, you can replace * with space after %f in hardstatus string with two spaces ( sorry for strange sentence, but SO text engine eats spaces in backticks weirdly ) - but without adjusting spaces after tab's number for non-active and non-last tabs they continue "to jump".