See: http://blogs.testbit.eu/timj/2005/11/01/01112005-my-brand-new-toy/ (page moved)
A few days ago, stefan demoed x2x to me, and i’ve fallen in love with it since. If you’re not regularly working with multiple machines (like a desktop and a laptop next to it) it probably won’t be of much use, but if you do, this little program allowes you to forward mouse and keyboard events from one X server to another simply by leaving the screen with the mouse (it also allows relaying of the PRIMARY selection between displays). So i’ve put my old laptop next to the desktop screen now and use it as some kind of screen extension, mostly for IM/IRC. Here’s the ssh command i’m using from the desktop machine to spawn the forwarding without doing insecure xhost hackery:
ssh user@remotehost -X 'DISPLAY=remotehost:0.0 x2x -from $DISPLAY -east' </dev/null &
Note that the
$DISPLAY
is evaluated by the ssh shell and will expand to the display of the forwarded X connection, instead of the display value x2x is started with.