Synergy is a cross platform tool that allows you to share your keyboard and mouse across any device with a synergy client running – this means you can use one keyboard and mouse and still use all your Mac/Windows/Linux devices (including your Raspberry Pi!).
Instead I will focus on showing you how to install Synergy on your Raspberry Pi, more specifically your Pi running Raspian. Note that this tutorial will not benefit users of a headless OS such as Raspbian Lite.
Before you begin, you must set up a synergy server on your main PC (the one with the keyboard and mouse you intend to use).
Whilst setting up the server, be sure to add a computer via the “Screens and Links” tab and name it “pi”. Your server setup should look something similar to the following:
To install Synergy on your Pi, we will be using the trusty apt-get package manager that we’ve used a number of times so far. The command is simply:
> sudo apt-get install synergy
If it asks you to continue simply enter “y” and hit enter.
That’s it! You have Synergy installed (aren’t package managers amazing?!)… but not yet configured!
Configuring Synergy Client
The last piece of the puzzle is to configure the pi as a Synergy Client, by telling it the name of the server you wish to connect to.
To do this, we will create a shell script which starts up synergy on our Pi using the connection settings we specify. To create this script, enter the following into the terminal:
> sudo touch /usr/bin/startsynergy
This will create our script named “start synergy” in the “/usr/bin” directory, which is on the system path by default, allowing us to execute the script anywhere with the command “startsynergy”.
Open up the script using the Nano Text Editor:
> sudo nano /usr/bin/startsynergy
Enter the following:
killall synergyc # Kill all previous synergy clients
sleep 1 # Wait 1 second
synergyc --name pi <server name goes here> # See below
exit 0 # Exit gracefully
Save the file by pressing “CTRL + X” and hitting “Y” to confirm the save.
The main contents on the script is the last line starting with “synergyc –name…“
We are setting up a synergy client with the name pi (or whatever you specified as the pis name when you added a second computer on your synergy server).
Lastly <server name goes here> should be replaced with the name of your Synergy server, again, this is specified on your Synergy server setup.
Running Synergy Client
To run the script, we first need to tell the pi that this file should be executable. To do this enter the following:
> sudo chmod +x /usr/bin/startsynergy
Now finally, we can simply run the client with the following command in the terminal on the Pi:
If your Synergy server was running, you should now be able to see “client pi connected” in the output log (on the server) and you should be able to use your keyboard and mouse seamlessly across your PC and your Pi.
Nick Cullen is a software developer living in South Wales, UK.
He is primarily focused around coding in C++ and C# and loves tinkering with new programming languages and technologies.
A key technological interest of his is Raspberry Pi development, which he has helped pioneer a unique product commercially using a Pi and programming the software in C++.
View all posts by Nick