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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
screenhas two status bars, the caption bar and the hardstatus bar, both of which use the string escapes specified in the “STRING ESCAPES” section of man screen. Unfortunately, there is no escape that directly refers to the session name.However, there is a hack that will allow you to do this.
screenpasses the session name to the shell using the$STYvariable. When the shell attempt to set the window title (using one of these methods)screencaptures that attempt, and stores it in something it confusingly calls “the window hardstatus,” which does have an escape that you can use:%h.So if you have either the caption or hardstatus bar set to include
%hand have the shell attempt to set the window title to$STY, then the%hwill be replaced with the session name when the bar is displayed.