Synergy Setup for Raspberry Pi Thumbnail

Synergy Setup For Raspberry Pi

Introduction

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!).
I won’t talk about setting up Synergy on your PC, as this is extensively documented. If you want to know how to do this, here is a YouTube video showing how to setup Synergy for your main PC.
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.

Prerequisites

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:

Computer Setup for Synergy Server Image
Computer Setup for Synergy Server

Installing Synergy

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:
#!/bin/bash

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:
> startsynergy
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.
TIP: To make your synergy script execute on startup, read my post on how to execute a script on startup.

Published by

Nick

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++.

4 thoughts on “Synergy Setup For Raspberry Pi”

  1. Thank you for the easy to follow instructions. I thought to find this info on the Synergy site but… no. I’m going to read the rest of your stuff on the Pi soon. Advice like this is valuable. Truly.

  2. Hello Nick,
    good article. I am having Synergy 1.6.2 running with my Linux Mint (Server) and Windows 7 (client), but to use my windows 7 the linux machine has to run.
    I also have a raspberry Pi3 running some services 24/7. I want to make the Pi to the Synergy Server, because it is always on.
    Any ideas about how to setup that constellation?

    Thanks

  3. Synergy 1.10.0 is available with Pi support now, at least for subscribers. The package manager will install 1.4 (I suppose this might change). 1.10.0 installs without the package manager but if you do it that way then the script requires the full path to the executable. i.e. /usr/bin/synergyc –name etc etc. If the Pi is your server (not typical I expect) the executable is synergys instead of c. It took me an inconveniently long time to discover this simple information along with the line entry to run the script at boot time needing to go in lxde-pi on the 3b. Maybe my experience would help someone. Reading Nick’s howto certainly helped me.

    1. Hi, thanks for sharing this information – I’m sure it will certainly help 🙂

      I am glad this guide has helped you solve the issue!

Leave a Reply