Start synergy script Mac OSX Client to Windows Host

I’ve long been a synergy fan, and found that especially at work that multiple monitors work best when spread across extra computers.  It’s like physical distributed computing.  Now, part of learning how to work on a MacBook is being lazy and wanting to control it from my main windows machine, so I don’t have to do any moving, and my MacBook becomes “just another monitor”. Using OSX 10.8 and Windows 7, I had a lot of problems with the latest 1.4 version(s), mainly in Windows.  I found synergy 1.3.8 much more stable, however harder to setup.  The following is my setup of Windows 7 as the server to OSX 10.8 as the client, with windows keyboard mapping to OSX (mapping Command, Home and End keys)

Setting up the Windows Synergy Server

After downloading the older version of Synergy, you can configure it like you used to as far as screens.  The next thing was figuring out where to edit the Synergy config.  At the start screen you can click the “Info” button, and this will show you the path to your local Synergy config file.  Next you can edit that file and add the following to the “screens” section, for me I wanted to map my Windows keyboard to be the same placement as my Mac – so Alt = Command, and Windows = Alt/Option.  When using terminal I like control to still be control, either platform, this is why I don’t touch it.

section: screens
    Windows-PC:
    MacbookPro:
        alt = super
        super = alt
end

Configuring the OSX Synergy Client

The *nix client to Windows server has been historically problematic for me.  Unstdio helped me write a slick shell script using winexe to have a “one-click” startup of synergy from ubuntu a long time ago: http://www.unstdio.org/blog/2011/06/07/make-windows-calls-from-linux/

On the Mac side it never seems to work resolving the Windows hostname – and instead I have to use the IP address.  Which is where the above script, and this one below help bridge the gap.  For my OSX script I just needed to install Samba so I could use nmblookup.

PROCS=`ps aux | grep 'synergycsd+' | awk {'print $2'}`
for p in $PROCS;
do kill $p;
done;
IP=`nmblookup Windos-Name | grep 172. | awk {'print $1'} | head -n1`
synergyc $IP
  1. get any currently running synergy clients
  2. KILL THEM
  3. Get IP address
    • I do the nmblookup on the hostname, I got mulitple IP records
    • Filter by the “right” starting IP
    • I’d get one record for the Wired, and Wireless connections, give me the first
  4. Start Synergy

For the keymapping the config on the server will take care of Alt and Windows, everything else needs to happen on the OSX side.  Mainly I wanted use of Home and End to mean go to start of line, and end of line respectively.  This blog post is all you have to do (and he has the proper mappings for Windows -> OSX use): http://mwholt.blogspot.com/2012/09/fix-home-and-end-keys-on-mac-os-x.html

Happy Mac-ing from your Windows PC!

Leave a Reply

Your email address will not be published. Required fields are marked *