19 June 2007

How to use Synergy between a Linux and Windows machine

Filed under: Computers

I’ve had such a great response from my Synergy on Two Ubuntu boxes post I’ve decided to make one for those of out there who want to use Synergy on an Ubuntu box and a Windows box.

I do this as well, when I dual boot my other Ubuntu machine to Windows, so I can keep using the one keyboard and mouse.

For those of you who are just joining us and haven’t seen my previous post about Synergy on Two Ubuntu boxes, Synergy lets you easily share a single mouse and keyboard between two or more computers, with two or more monitors, without hardware.

Redirecting the mouse and keyboard from one machine to the other is as easy as moving the mouse off the edge of your screen towards the other monitor. Synergy also merges the clipboards of all the systems into one, allowing cut-and-paste between systems.

In this example, we’ll be setting Synergy up to control one Ubuntu Linux machine and one Windows XP machine. However, these instructions are not distribution specific and should work on any system that has Gnome installed with just a little tweaking.

First, you’ll need to download and install the Synergy program to both of the machines you want to control. You can download it from SourceForge here. You will need both the Windows and Linux versions.

Now that we have it installed, you need to decide which machine you want to be the server and which you want to be the client. Once you’ve done that, we’re half-way there! In this example, we’ll use the Linux machine as the server and the Windows machine as the client. First, we’ll set up the Linux machine.

This is the tricky part, but follow closely and everything will work just fine.

Create a new text document called synergy.conf. Put it someplace out of the way, because after we’re done here you won’t be needing it again, but will have to know where it is.

In this synergy.conf document we’re going to tell synergy the names of the computers we want to control and what the screen layout is of those computers. Here is an example of my synergy.conf file:

section: screens
section: links
right = beaukitty
left = josie

Josie is the hostname of my Ubuntu box, Beaukitty is the hostname of my Windows machine. Josie’s monitor is to the left of Beaukitty’s monitor, Beaukitty’s monitor is to right of Josie’s. So what we’re saying in this synergy.conf file is that when the mouse gets to the right of Josie’s monitor, it appears on Beaukitty. And when the mouse gets to the left of Beaukitty’s monitor, it appears on Josie. That simple.

So write your file with your computer’s hostnames and their positions relative to each other. When you’re done, save the file and close it.

Now, we’re going to test how everything works.

On the Linux machine that is going to be the server (in my case Josie), open a terminal window and type:

synergys -f – -config /path/to/your/synergy.conf

What we’ve done here is launch Synergy in server mode on the server machine. The -f parameter tells Synergy to run in the foreground so we can see if everything works. If all is well you’ll see Synergy fire up and report that it has started the server. If there is an error, it will display here what is the problem. Most of the time it’s because Synergy can’t find the synergy.conf file, so be sure you entered the path correctly.

Now, on your client machine (in my case Beaukitty) launch the Synergy program. Click the Use another computer’s shared keyboard and mouse (client) radio button. Enter the server’s computer name next to Other Computer’s Host Name (in my example Josie). Click Test.

Now, if all has gone well, you should be able to move the mouse on the server from one monitor to the other, and once the mouse cursor is on the other monitor, use the server’s keyboard on the client.

Once you’ve got everything up and running to your satisfaction, quit the Linux Synergy process by hitting CTRL-C in the terminal window, and click Stop on the Windows machine.

To have Synergy run at startup (which is the logical thing to do) we’re going to place some additions into the Startup programs in the Sessions menu on the Linux machine, and add it to the startup items on the Windows machine.

On the Linux machine select System > Preferences > Sessions and click on the Startup Programs tab. Click the New button and type Synergy into the Name box and type:

synergys – -config /path/to/your/synergy.conf

into the Command box. When you’re finished, click OK.

On the Windows machine, before clicking Start in Synergy you may want to set the Logging Level to Warning so the logging window doesn’t pop up (because you can’t close it, just minimize it, which is kind of annoying). Click the Configure… button by the text Automatic Startup. The Auto Start dialog will pop up.

In the Auto Start dialog you can configure Synergy to start or not start automatically when the computer starts or when you log in. You need Administrator access rights to start Synergy automatically when the computer starts. Set it to your liking and click OK.

Restart both machines and you’ll be able to only have one keyboard and mouse on your desk.


If you run into trouble, check out the troubleshooting FAQ on the Synergy home page here.

Leave a Reply