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.

Can somebody please explain or point me to good tutorial about "String Escapes" used in ~/screenrc. I am playing with $PS1 and ~/.screenrc. While $PS1 seems pretty clear (colors, conditions, escape characters ...) "String Escapes" is big unknown. I've tried to read info screen "String Escapes" but the only thing I get from it is that string uses escapes for special purpose, e.g. %H for hostname, %D for week name etc. Now I am using following line which I get somewhere from internet

hardstatus alwayslastline '%{= kG}[ %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

This hardstatus looks like:

[ (0*$Dropbox)  1-$ ~  2$ init.d  3$                  ][2013-09-16 17:57 ]

What I was trying to add '[]' around inactive windows titles, something like:

[ (0*$Dropbox)  [1-$ ~]  [2$ init.d]  [3$ ~]          ][2013-09-16 17:57 ] 

But with no luck. Can somebody please clarify what is going on in this string?

'%{= kG}[ %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

Thank you

share|improve this question

1 Answer 1

You shall refer to String Escapes part of the Screen Manual. Then deciphering of your hardstatus string should pose you no complicated problem.

'%{= kG}[ %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
 \______/ \____/\/\__/  \__/ \__/\_____________/\___/\__________/  \_/\____/\__________/ \____/ \___/
    1       2    3  4     5    6        7         5       8         9   10       11        12     13
  1. Sets bright green text on black background for opening [
  2. sets white text on black background,
  3. text until next %? is displayed only if enclosed % escapes are expanded to non-empty strings,
  4. shows windows up to the current one with flags,
  5. sets red text for opening and closing parentheses,
  6. sets bright white text,
  7. shows window number, it’s flags, title and, if there are any, other users,
  8. if there are any other windows, displays them in white text,
  9. horizontaly fills with white space,
  10. shows green ][,
  11. shows year-month-day in bright blue,
  12. time in bright white,
  13. and finaly closing ] in green.
share|improve this answer

Your Answer

 
discard

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

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