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?
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?
screen
has 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.
screen
passes the session name to the shell using the $STY
variable. When the shell attempt to set the window title (using one of these methods) screen
captures 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 %h
and have the shell attempt to set the window title to $STY
, then the %h
will be replaced with the session name when the bar is displayed.