For some time now I connected my MacBook to an external display and use it in clamshell mode. Therefore I use a litte tool called synergy as a KM switch, which shares one keyboard and mouse (and your clipboard!) via network between several computers. However I had some troubles to start synergy automatically as described on its homepage.
In order to start synergy automatically when you log in, you have to use launchd for Leopard. Create a plist file for launchd with the configuration for synergy, e.g. /Library/LaunchAgents/net.sourceforge.synergy2.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.sourceforge.synergy2</string>
<key>ServiceDescription</key>
<string>Synergy Client</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/synergyc</string>
<string>--no-daemon</string>
<string>--no-restart</string>
<string>--debug</string>
<string>WARNING</string>
<string>--name</string>
<string>MacBook</string>
<string>192.168.1.1</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
After this adjust the permissions of the file:
sudo chown root:wheel /Library/LaunchAgents/net.sourceforge.synergy2.plist
and to load or unload the daemon tell launchd to load the script:
sudo launchctl unload /Library/LaunchAgents/net.sourceforge.synergy2.plist
sudo launchctl load /Library/LaunchAgents/net.sourceforge.synergy2.plist