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


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.

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.