Let's attach to not-detached session few times:
In one terminal (say having pts 11):
$ screen -x #say this will get pid 111
In another one (say pts 22):
$ screen -x #get pid 222
Is there a way to programatically distinguish these two from inside of the screen?
OR (in another words)
Is there a way to link pid 111/222 or pty 11/22 to currently opened window inside?
Note I can tell "manually" by invoking screen command ":displays" (C-a *). But it seems that is not possible to redirect output of screen commands somewhere (to be clear: screen commands (C-a :), not commands in the screen).