Sunday, January 4, 2009

x2vnc : One keyboard (and mouse) to control them all ...

So you need a windows machine (we're not going to go into why right now), in addition to your Linux box. The box in question is a complete physical box; but you discover it's becoming cumbersome managing two mice and keyboards on your desk.

What you need is x2vnc.


  1. Install x2vnc.

    Using your distro's package manager, install x2vnc. For example, on ubuntu : sudo apt-get install x2vnc does the trick. If x2vnc doesn't reside within your distro's repositories, you might have to install it directly from the author's site. At the time of publishing, the current version available was 1.7.2 and could be obtained here.

  2. Install a VNC server on the Windows box.

    You need to have a VNC server running on the windows box for this to work. There are various free alternatives available; one of which being TightVNC which can be obtained here. Install a VNC server, and start it up on the windows box.

  3. Fire up x2vnc

    There are various options available to you when running x2vnc; these can be obtained by running x2vnc --help; or see the "usage" section here.



    The most basic usage is
    x2vnc -east[|-west|-south|-north] {hostname/ip address}:{display}

    note:  The -east / -west / -south / -north parameter to use depends on where the windows box's screen is in relation to your screen. If the screen is to the right or yours, you use -east, and so forth.

    note:  If your VNC server is password protected, you will be prompted to enter the password directly after executing x2vnc.





Now for the big test, with x2vnc running, move your mouse "out of your screen" to the right (assuming you used the -east option). The mouse pointer should appear on your windows box's screen. You should notice that when the mouse pointer is visible on the windows box's screen, any keyboard activity (including shortcut key keystrokes) will be directed at the windows box, and visa versa.


As you also may have figured out by now, if you have more than one windows box, you could control all of them by running multiple instances of x2vnc.


Finally, if you would like to achieve the same effect with multiple Linux boxes (or anything running an X server), you should check out x2x.

3 comments:

  1. Or you could just use synergy...

    ReplyDelete
  2. There's an application called 'Synergy' which has Linux, OSX and Windows clients, and will allow you to set up one keyboard/mouse control over any number of machines you want, running any combination of supported OS's.

    You simply set up one machine as the server, and configure it to list all the connected machines, and their position relative to each other...and then run the client app on the other machines. When you're all set up, you can simply move your mouse 'out' of the window you're in, 'onto' the other machine. It even supports your clipboard, although it struggled when it there was a lot of data in there (such as an image).

    I used it to simultaneously control a Mac, a PC and my main Linux development box, and for an experiment had it running to control 5 machines, and it works flawlessly for me.

    It also benefits from only having to run a single instance per machine for however many computers you wish to control, and there's both command line and GUI versions of it.

    ReplyDelete
  3. Thanks for the comments, much appreciated. Will be sure to check out synergy!

    ReplyDelete