The other day, several clients from up north came to visit as we helped them launch a new marketing product. As they sat watching me pound out code on my computers, they were quite curious about my three monitors. They watched me flow back and forth amongst the three, changing this, checking that, saving here, reloading there… normal operations for me, but not for them. One, who had some previous programming experience, asked if I preferred Linux to Windows. I replied that both had their uses and so I was using both. He was somewhat taken aback by my statement and looked closer at my monitors.
Yep, two windows, and one linux…
But how could that be? You can’t use the same keyboard and mouse on two separate boxes running two separate operating systems!
At least you couldn’t until Synergy.
According to their site, “Synergy is FOSS that lets you easily share a single mouse and keyboard between multiple computers with different operating systems, without special hardware. All you need is a LAN connection. It’s intended for users with multiple computers, where each system uses its own display.”
That sounds great, let’s see how it works.
First, the setup
I have two computers. One running Windows 7 which I use primarily for email, messaging, graphics alterations, video editing, sound manipulation, Windows only programming, general browsing, and running several mysql gui clients. The other is a Fedora Core 12 box running Fedora Core 12. I use it primarily for running Eclipse and anything else that linux tends to run better than windows.
Then there is Installation and Setup
It’s fairly easy to install. Especially on Windows. The setup on Windows looks something like this:
The first thing that needs to be done is the Configure Button. Clicking it opens another window:
Here I have two boxes, here called “Screens”, already setup, here is what you get when you add or edit a “Screen”:
The most important part here is to correctly list the aliases. When a computer tries to connect to Synergy running on this, the server, it is identified by the hostname, usually, or the NetBios name in the case of windows computers. If the aliases aren’t right in here, you won’t be able to connect.
Here’s a look at the Windows box aliases, notice the NetBios name of my Windows box, Jay-PC.
Once the “Screens” are defined, you use this window again to define which screen is on which side of which other screen. In my example, I am just mapping 100% of the right of one screen to 100% of the left of the other. But you can get as creative with this as you want, generally sticking with the physical location of each screen to each other. I have seen people with one screen mapping to two screens above it, it works. And well.
After all the machines are setup so the server knows where to put them and how to match them up, we setup the Linux Box. The basic installation was easy enough, Fedora Core 12 has it in their Yum repositories. I installed synergy+, so my command line to install looked something like:
[root@test-accounting ~] yum install synergy-plus
After installing, we need only run this:
[jay@test-accounting ~] synergyc 192.168.9.69
where the ip address given to synergyc (the Synergy Client) is that of the Synergy Server. And it works! But now we want to get it so it starts automatically when the box boots so that we don’t have to have a keyboard and mouse hooked to it at all…
Auto starting on linux
There are several tutorials for this around the web. I couldn’t get any of them to work right. Some worked before login only, most worked after login only. Whatever. So this worked for me. You will probably need to read this and several others to get it working just right for your setup.
Here it is.
The first is /etc/gdm/PostLogin. Yes, I am using gnome. Big whoop. Wanna fight about it?
Add these lines to the file, obviously substituting my ip for yours:
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
Next, edit /etc/gdm/PreSession/Default and add the same lines to it.
Finally, edit /etc/gdm/Init/Default and add those lines to the bottom if it, just above the exit 0 line.
Reboot, reconnect, and rejoice.