Let's say I want to bind a key sequence in GNU screen
to jump to a specific window. I might do so like this:
bind ^t exec screen -X select foo
(I've deliberately simplified this; the real-world application exec
s a command which dynamically figures out which window to switch to, then runs the screen -X
command.)
Great; this works well. The problem comes when I've attached (via screen -x
) to the same session from a different machine. On the new machine, ^a^t
does as expected and switches to the window. But, if I return to the original machine, leaving the new machine attached, then ^a^t
switches to the window on the new machine. If I detach the new machine, everything goes back to working as normal.
Note that this is one session, so -S
is of no use. The session is not password-protected. It also doesn't seem to relate to the exec
machinery: while manually running screen -X select foo
inside screen
on the original machine works properly, running it in a separate terminal on the original machine (i.e. outside screen
) still switches the window on the other machine.
How can I force screen -X
to affect only the attached user on the same machine it's being run from? (Affecting both users/machines would also be acceptable, if that's easier.)
ssh $orig_machine
and then, once logged in,screen -A -x $screen_name
.