Konsole tab title and GNU screen session name

How can I automatically change the tab title to reflect the screen session name?

When opening screen with a session name like “screen -S Foo” will set the environmental variable “STY” to pid.session so something like 13579.Foo. I’d like the tab title to be “foo” in this example. I’ve looked at the “Configure Tab Settings Dialog”, I haven’t seen an obvious way of doing it. Using bash.

Hoping someone has some suggestions.

Thanks.

Ended up using the following:

Set tab title format to “%w”
Then enter: echo -ne "\033]0;$(echo $STY | cut -f 2 -d'.')\007"