[TAG] [2c Tip] Using two computers with one kbd/mouse
Kapil Hari Paranjape
kapil at imsc.res.in
Sun Apr 30 07:58:37 MSD 2006
If some of you are unlucky(:)) enough to get confused because
you have two computers on your desktop and you forget which
keyboard/mouse is connected with which computer then this tip
You need to choose "master" which is the computer connected to
the keyboard/mouse you will actually use. You can later put away
the mouse and keyboard of the other computer in order to avoid getting
confused. The "master" must be an X-window machine(*) but the "slave" can
After you execute these steps and "go west" off the screen on the
master your keyboard and mouse events will be directed at the slave.
You need to install "x2x" and "x2vnc" on the master.
"slave" is also X-window.
From the slave log in to the master using ssh X forwarding
slave:$ ssh -X luser at master
Then run "x2x" on the master via this ssh session as follows
master:$ x2x -from :0 -to $DISPLAY -west &
Here you replace west with the appropriate direction (west
equals left and north equals up) in which the monitor of the
"slave" is Linux in "console" mode.
On the slave you run "linuxvnc"
slave:$ linuxvnc &
This will give you a port number (usually 5900) which you
must use below. I'll use 5900 as the port since that is
standard. Next start an ssh tunnel to the master.
slave:$ ssh -f -N -R 5900:localhost:5900 master
Finally on the master you run
master:$ x2vnc -west localhost:0 &
"slave" is "OtherOS".
On the slave you need a VNC server like "WinVNC" for Windows
and "OSXVnc" for Mac OS X. You also need "ssh" unless you allow
the VNC server to accept connections over the net (bad
security). You then follow the same sequence:
(a) start the VNC server on slave
(b) start the ssh tunnel on slave
(c) start x2vnc on master.
(*) I know that I should use the term "machine which is running an
X-server" instead of X-window machine but I hope the nomenclature is
(**) There are other options like clicking in a window to switch the
focus but this "trick" of going west seemed the neatest.
Hope this magic helps someone.
More information about the TAG