Search this blog:

Words and works.

Synergy: Inter-platform Keyboard and Mouse Sharing

For more than a year now, I've been sharing a Flat Panel LCD Monitor between a PowerMac G5 and a Dell PC running Windows XP. The monitor has both a VGA and a DVI input which allows me to switch between the two computers with the push of a button on the front of the monitor. I love it. The issue I've been dealing with, however, is that I use a separate keyboard and mouse for each computer. It's become all too common for me to type a sentence or two before realizing I'm on the wrong keyboard. I'm pleased to report that this problem is now solved!

I've just discovered a terrific utility that uses the network to share the mouse and keyboard between the two displays. It's called Synergy. This nifty software lets me use my two systems as one virtual desktop. When the mouse leaves the right side of the PowerMac desktop, it jumps over to the left side of the Windows XP desktop (in my setup I have to push the button on my monitor to switch desktops - if I had room for two monitors, this feature would be even sweeter). Synergy also manages a shared clipboard enabling cut, copy, and paste between the two systems, and will optionally synchronize your screen savers: when one system's screen saver kicks in, they all kick in. Nice. Another of Synergy's attractive features is that it is open source and free.

OK. Enough celebrating. If you're interested in some of the gory technical details, read on. If not, thanks for stopping by.

It's not as simple as it could be to set up and configure on the Mac, but graphical tools are coming along. A Windows Installer makes set up on Windows easy.

I set up the machine running Mac OS X Tiger as the Synergy "server." The Mac's name is "EC-OSX-G5-1" and the Windows XP box is named "EC-WXP-P3-1." I put the following text in /etc/synergy.conf: # synergy configuration file # section: screens EC-OSX-G5-1: EC-WXP-P3-1: end section: links EC-OSX-G5-1: right = EC-WXP-P3-1 EC-WXP-P3-1: left = EC-OSX-G5-1 end

To get the Synergy server to start up automatically when the Mac boots up, I created a SynergyServer directory in /Library/StartupItems and put two files there: SynergyServer and StartupParameters.plist. Below is the contents of these files:

SynergyServer: #!/bin/sh . /etc/rc.common run=(/Users/dougevenhouse/bin/synergys --name EC-OSX-G5-1) KeepAlive () { proc=${1##*/} while [ -x "$1" ] do if ! ps axco command | grep -q "^${proc}$" then "$@" fi sleep 3 done } StartService () { ConsoleMessage "Starting Synergy Server" KeepAlive "${run[@]}" & } StopService () { return 0 } RestartService () { return 0 } RunService "$1"

StartupParameters.plist: { Description = "Synergy Server"; Provides = ("Synergy mouse and keyboard sharing server"); Requires = ("Network"); OrderPreference = "None"; }

Since the Mac is also a client, I created a SynergyClient directory in /Library/StartupItems. Here's the contents of that directory.

SynergyClient: #!/bin/sh . /etc/rc.common run=(/Users/dougevenhouse/bin/synergyc -n $(hostname -s) -1 -f EC-OSX-G5-1) KeepAlive () { proc=${1##*/} while [ -x "$1" ] do if ! ps axco command | grep -q "^${proc}$" then "$@" fi sleep 3 done } StartService () { ConsoleMessage "Starting Synergy Client" KeepAlive "${run[@]}" & } StopService () { return 0 } RestartService () { return 0 } RunService "$1"

StartupParameters.plist: { Description = "Synergy Client"; Provides = ("Synergy mouse and keyboard sharing"); Requires = ("Network"); Uses = ("SynergyServer"); OrderPreference = "None"; }

Note that the "Uses" directive tells the OS that SynergyServer needs to be started before the client is started.

Tags: kvm, macosx, opensource | Permalink

© 2009 Evenhouse Consulting, Inc.

A Django site.