0

For older versions of gnu-screen (i.e. without the %S), I found out how to print the session-name in the hardstatus or caption of gnu-screen by reading this answer.

The solution is to add the following lines to your .screenrc:

hardstatus string '%H:%`'
backtick 0 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*"'

How do you append text after the session-name prints?

1 Answers1

0

This is more of a question of what are the semantics of the %` and backtick command in gnu-screen. Here's what I found to work:

caption always 'gnu-screen: host=%H, session=%`, text message to append'
backtick 0 30 30 bash -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*"'

You need to read the documentation on gnu-screen backtick to be able to understand what is happening. Once you read that the solution is much more straight forward.