X11 Remote Control

x2x is a brilliant little remote control for X11. For example when you are working at different computers simultaneously it can make life much easier. Mouse and keyboard commands are sent to other xservers as well as it copies the clipboard. The standard X11 protocol is used, so the usual tricks and ssh tunnels work fine.

I have a shortcut on my laptop to “invite” the keyboard and mouse of my desktop at work. To avoid exposing the xserver, a bit of ssh tunneling is done:

ssh -f -n -X desktop.at.work
  'export DISPLAY=:0.0;ssh -n -f -X cap@`echo $SSH_CLIENT | cut -d" " -f1` x2x -west -to :1.0';
echo "connecting X server ..." |
  osd_cat -A right -s 2 -f -*-helvetica-bold-r-&#-20-&#-&#-&#-*

After that, the mouse pointer can leave the desktop screen on the left (west) and will enter the laptop screen on the right. Whichever screen the mouse is residing in will receive the keyboard events from the desktop keyboard. osd_cat is merely used to print a notification of what is happening on the display.