Thursday, August 25

x2x beats synergy in a 2 computer configuration

I have used synergy for years so when my laptop is on my desk I can easily use one keyboard to control both my desktop and laptop.  However, either through recent changes in X windows or changes in synergy, I often have issues where left clicking and keyboard operations are simply broken.

Enter x2x.  There are a number of limitations, not the least of which is an inability to share clipboard and you are limited to 2 computers.  The clipboard is a slight limitation, but I've never had  a need for more than 3 or 4 displays and two computers can easily keep up with that requirement.

The most important things to me are speed and stability and I get both of those with x2x.  I also don't need start software on both machines to make it work, ssh does all of that for me.  However, I do need to have x2x installed on both machines.  On Ubuntu that's s simple command:

sudo apt-get install x2x

Next, on the computer that is sharing the keyboard and mouse(the from machine), execute this command:

ssh -XC user@host x2x -east -to :0.0

If you have set up key authentication, this will automatically log you in and start the session.  If you specify -east like I did and you move your mouse off the right side of the screen, it will now show up on the host that you specified.   I have not had the opportunity to do so yet, but at some point I will try it the opposite direction, specifying -from instead of -to in order to see if I can make this work every time I turn my laptop on and my desktop is available on the network.  You can do this with a simple startup script that does a single ping to a machine on the network and returns the result.  Theoretically(as I said I haven't tested yet) this should work.

ping -c 1 host
if [ 0 -eq $result ]; then
    ssh -XC user@host x2x -west -from :0.0

EDIT: Confirmed, the code above works quite well.  Set that up as a startup script in Gnome and it will automatically share mouse and keyboard whenever you start up the machines on the same network.

Enhanced by Zemanta

No comments: