Running Synergy at startup on MacOS - dagelf/synergy-core GitHub Wiki
Here we create a shell script and a property list file (plist), and activate the plist using the launchctl command-line tool.
The shell script runs the synergyc Unix executable, telling it to connect to a laboratory workstation. The property list file [please].
First make a little bash script or whatever to contain your synergy calls..
For example, I put mine in ~/.scripts/synergyscript.sh
Here's what my script looks like:
#!/bin/bash ## Synergy client, connecting to Lab workstation /Applications/Synergy.app/Contents/MacOS/synergyc -f -d FATAL -n Intrepid 192.168.1.102
Here I'm telling the synergy client I'm running to announce my machine's name is Intrepid and I'm getting to to connect to the ip 192.168.1.102.
I used this format so that I might later add additional separate instances of synergy, as this was on a laptop that moves around.
Then make sure you make your script executable:
chmod +x ~/.scripts/synergyscript.sh
does it need to be made executable? we don't need that to run it manually. Does launchctl or the plist require it?
Run the script manually to confirm it works:
~/.scripts/synergyscript.sh
If it works, you should see [please]. If it doesn't work, you might see [please]. In that case, try [please].
I created my plist file under ~/Library/LaunchAgents/ca.dawning.scripts.osx.synergy.plist
It contains:
<?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>ca.dawning.scripts.osx.synergy</string> <key>Program</key> <string>/Users/j/.scripts/synergyscript.sh</string> <key>KeepAlive</key> <true/> </dict> </plist>
launchctl load ~/Library/LaunchAgents/ca.dawning.scripts.osx.synergy.plist
To unload it, just swap that load above with unload.
Using a Mac OS X 10.6.8 server with synergys 1.4.12 and a Windows 7 SP1 client with synergyc.exe 1.4.12
Create a config file ~/Library/Synergy/synergy.conf (or where ever) with the following contents:
section: screens win: alt = super super = alt halfDuplexCapsLock = false halfDuplexNumLock = false halfDuplexScrollLock = false xtestIsXineramaUnaware = false switchCorners = none +top-right +bottom-right switchCornerSize = 0 osx: halfDuplexCapsLock = false halfDuplexNumLock = false halfDuplexScrollLock = false xtestIsXineramaUnaware = false switchCorners = none switchCornerSize = 0 end section: aliases end section: links win: right = osx osx: left = win end section: options relativeMouseMoves = false screenSaverSync = true win32KeepForeground = false switchCorners = none +top-left +bottom-left switchCornerSize = 32 end
Create a file ~/bin/initsynergy.command with the following contents:
# Hides tray icon. set to 0 to have it show again. defaults write /Applications/Synergy.app/Contents/Info LSUIElement 1 /Applications/Synergy.app/Contents/MacOS/synergys --enable-crypto --config ~/Library/Synergy/synergy.conf -n osx -l /var/log/synergy.log
Make sure you:
sudo touch /var/log/synergy.log sudo chown YOUROSXUSERNAME /var/log/synergy.log
Add ~/bin/initsynergy.command to your account's Login Items in System Preferences -> Accounts -> Login Items