Sharing a mouse and a keyboard across systems with Synergy

Synergy is an application for OSX, Unix, and Windows that allows you to share a mouse and keyboard across any number of these systems. The Unix version uses the XTEST extension, and as such should work on any Unix system whose X server features this extension. It is licensed under the GPLv2.

Synergy Warp Image

I haven't used the Unix version, so I don't know if there are any special caveats there, but I have used the MacOSX version, which is the same thing. Incidentally, a binary package is only made available for redhate (in rpm form) so if you want it for another Unix you'll have to compile it from sources yourself.

Synergy for Win32 Main Dialog

Windows setup is easy. So easy it almost doesn't bear description here. For this reason, it is advantageous if Windows is your server, because clients don't have setup. You only need to do one thing on the client - run the client program, or run the win32 program as the client, and specify the name or IP address of the server system. The server must be able to resolve all hostnames used in your configuration to IP addresses, or have aliases for same.

In order to configure Synergy for Windows, run the program. (I will assume you have figured out how to install the thing - since it's got an installer.) It pops up a GUI that has three subpanes. The first one is what you use if you're running it as a client. You'd check the first radio button, fill in a hostname or IP address, and click start. We're not doing that. We're checking the second radio button, "Share this computer's keyboard and mouse (server)". Then we click on the Configure... button.

The short form is that there's two listboxes here, one for screens and one for what you do with them. Create two screens; their names are to be the same as your hostnames. You could give them any names you want but this is the only thing that makes sense. If your system can resolve these hostnames, you won't need aliases. Just click the +, and type the name of the host in the little dialog that pops up. If you can't resolve the host name, then under aliases, put the IP address.

Synergy Win32 Config Dialog

Next, under links, we define the relationships between these screens. They don't have to link back either; you could put together a maze of displays if you wanted to. I assume you probably don't want to. I'm also assuming you have two screens, because I'm lazy, and because doing more isn't harder, it's just time consuming. All you have to do here is pick some stuff from the pulldowns and then click the plus button. I realize that this is inconsistent to the way the top of the window works - I didn't write it, so don't complain to me. Just complete the sentence: x to y percent of the {side} of {a screen} goes to z to q percent of {this screen}. For example, if you have two small screens to the left of a big one, maybe 0 to 50 percent of the left of your big screen goes to one, and 51 to 100 goes to the lower one. In my arrangement, even though I have three displays of different size and resolution, I went ahead and said that the whole thing moved to the next screen, both at 0 to 100 percent. This way the mouse pointer doesn't go where it looks like it's going to go, but it is consistent and I don't have to manouver the pointer through the part of the screen that overlaps the neighboring screen, it doesn't get messy if I move physical monitors around, et cetera.

Once you've done all this, click on OK, then on Start. If all goes well it tells you it's been started and that it's going to be a tray icon. Nifty.

Now for the clients. Windows clients, as previously stated, involve filling in the server's hostname under the client info stuff, where it asks you for a server name, and clicking start. This is all I did on the system to the left of my primary. The system to the right, however, is running OSX. All you have to do there is run path_to_synergy/synergyc -f hostname - it is important to know these values, of course. Regardless, this will point synergy at your server, from which it will receive mouse events.

There is also a server for OSX. The server must run on the system with your input devices. OSX and other Unix systems don't have a nice config GUI like the Windows version does (yet?) so you'll have to edit a config file. The things you actually need to do are quite simple, although there are tons of options I won't cover here. Below is a sample config file:

section: screens
    host1:
    host2:
    host3:
end

section: aliases
    host1:
        10.0.0.1
    host2:
        10.0.0.2
    host3:
        10.0.0.3
end

section: links
    host1:
       right = host2
    host2:
       left = host1
       right = host3
    host3:
       left = host2
end

It actually doesn't matter at all which of these is your server; what is important is that the config file be on the server. In this configuration, we have three displays in a row, belonging to host1, host2, and host3. In my case, host2 is the server. Names and IP addresses have of course been changed to protect the, uh, innocent.

Once you have this file, you can run the server on your OSX system. The syntax is:

path_to_synergy/synergys -f --config path_to_config/synergy.conf

Naturally, you don't have to call your config file synergy.conf, but that's the way I'd go.

Synergy Client for OSX in Scriptlet

In Linux you could just create a shell script and double-click it from your desktop. You can't do that in OSX, which is why there's ScriptGUI. ScriptGUI can run scripts for you, complete with its own cute little terminal window, and it can also create script "droplets" which are standalone applications which run scripts. I made a droplet that runs the synergy client.

I hope this helps some people, it did help me. For some reason I got the impression you needed a config file on every system, when you only need it on the server.

Comments

Thanks for your post. I think I'm using a newer version of Synergy (1.4.15), but I've been struggling to use it with Windows 7 (server) and OSX Mountain Lion (client). Your comments about how to create a configuration file and include aliasies for hostname:ip did the trick for me!

Add new comment