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.

I run multiple screen sessions each created with 'screen -S name' and I would like to be able to display in the status bar the name I used to create the current screen session.

However, I cannot seem to accomplish this. Any ideas?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This is coming in the next version: http://savannah.gnu.org/bugs/index.php?23738

Also, you can use the terminal variable $STY, though people seem to get inconsistent results with it.

share|improve this answer

This was successfully emulated by how to include screen's session name in hardstatus?

I enhanced it even further, as follows:

# generates equivalent of $STY followed by "on $HOST" if $STY is non-standard
backtick 10 60 60 sh -c 'sty=$(screen -ls | grep --color=no -o "$PPID[^[:space:]]*") ; if [ ${sty##*.} = $HOST ] ; then echo $sty ; else echo "$sty on $HOST" ; fi'
# includes session name thanks to backtick 10
hardstatus string "[screen %n%?: %t%? (%10`)] %h"
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.