Synergy for OSX Leopard

I recently setup my PC in the living room with my TV so I could play games and watch streamed video from the net (eg, BBC's iPlayer). Unfortunately this always meant having a keyboard and mouse attached.

Then came along Synergy.

[adsense:468x60:4496506397]

Synergy is like a software KVM switch... First you configure the server and teach it where the screens "are" (this will make sense in a minute). You start then server on the machine which has control of the keyboard and mouse - in this case my laptop - and the client(s) - in this case just my PC although you can configure more. The server keeps and eye on where the controlling mouse is on the screens. If you move it off one of the configured edges then you take control of the machine thats configured for that edge. For example, Screen B could be to the right of Screen A (and therefore Screen A is to the left of B - but not necessarily!).

In my case all I have to do on my Mac Book Pro is to nudge the pointer off the top of the screen and I then take control of the PC plugged into my TV!

Nothing is ever easy....

Unfortunately, it appears that Synergy (V1.3.1 at least) doesn't like running in Deamon Mode on OSX 10.5. Deamon Mode allows the server to run quietly in the background without requiring you to have a terminal window open all the time. For some reason it just crashes.

This morning I had a brainwave - the Screen command in UNIX operating systems allows you to start a process and detach it from the terminal! I generally only use this for applications I want to run on a remote machine from which I might get disconnected half way through (eg, if I want to run a long download which I can periodically check back on but dont want to break if my internet connection drops). Normally in UNIX, a process gets tied to the terminal it is run from so if the terminal dies (or the SSH connection to a remote machine), usually the child processes die with it. Screen stops this!

[adsense:468x60:4496506397]

I simply created a startup script like this

#!/bin/sh
screen -d -m /Applications/synergy-1.3.1/synergys --config /Applications/synergy-1.3.1/synergy.conf -f
exit

The -d -m options tell screen to start in a forked and detached mode!

You can then use the Accounts section in System Preferences to tell it to run the startup script upon login! Easy!