Sharing mouse and keyboard using synergy-plus

When you have to use multiple computers at the same time your desk tends to start filling with multiple mouses and keyboards. KVM switches are a possible solution but good ones aren’t that cheap and they usually make painful noises when switching to another machine. I’d like to have a solution where I can continue using all the monitors connected to each machine and just share my mouse and keyboard, preferably the mouse and keyboard already built into my Macbook Pro. With many thanks to Chris Schoeneman there already is such a solution, called Synergy.

Synergy is best described as a KVM switch over network, just without the M (for monitor), but in exchange with shared clipboard and across platforms with support for Windows, Unix/Linux and Mac OS X. Switching machines is as easy as moving the mouse cursor „across“ the border of the screens… just that. The keyboard follows the active machine that currently has the mouse cursor on its screen.

The sad thing about synergy is that there seems to be no more active development and so a couple of forks have been created with Synergy+ (synergy-plus) apparently being the most active one.


Although there are packages for synergy both for ubuntu and macports there are a lot of outstanding bugs especially for the OSX version so I directly started using Synergy+ by downloading the precompiled packages for Mac and Linux (x86_64.deb). Installation went fine without any problems so the next thing was considering the desired configuration.


Synergy uses a client/server model. The server is the host with the attached keyboard and mouse that are to be shared across all the machines. The server is also the only host that needs a configuration file. All the clients only need to know the hostname of the server, but more on that in a minute. Following is a sample configuration for two hosts, the client (desktop pc named linux.home) on left of the server (my Macbook Pro called notebook.home):

section: screens
section: aliases
section: links
                right = desktop
                left = notebook
section: options
        switchCorners = all
        switchCornerSize = 100

The configuration is really straight forward. In the „screens“ section you define the hosts in your setup. In most cases you name your screens just after the appropriate hostnames. When you do not want to take you hostname as a screen name or have the problem that OSX tends to forget about the domain that was distributed by DHCP you can setup an „aliases“ section to give a list of hostnames for each screen. NB: Both client and server command take an optional argument „––name“ to manually set the screen name for host.

The „links“ section sets the position of the screens. It is important to give the positions for all the screens, even though it should be clear that if screenA is left of screenB then of couse screenB is right of screenA. Not giving all the directions will result in the mouse trapped on one of the screens.

The „options“ section is for miscellaneous settings. In the above configuration I disabled all the screen corners (specified as 100px around the edges) for screen switches. In OSX there are a lot of features accessable by moving the mouse into one of the screen corners. Without these options the mouse would change the screen before reaching the corner unless you hit precisely the edge… not really suitable for daily use.

Many more informations about what else to configure can be found on the original synergy sourceforge page.

Getting startet

When all the settings are finished we save them into a file called .synergy.conf in the users home directory or in /etc/synergy.conf. Different locations can be specified using the „––config“ option of the synergy server command. Now we start synergy on the server host by invoking „synergys -f“ (note the s at the end, the option -f is for preventing the process from daemonizing).  When there are no reported errors we can start synergy on the client(s) using „synergyc -f hostname_of_the_server“.

You should be able to move your mouse across the screens now. When everything works fine, you can omit the -f and let the synergy processes daemonize into background.

Problems with mouse scrolling

I had the problem that mouse scrolling was not working on the client. While moving the mouse wheel I could see these messages in the client’s output:

WARNING: Wheel scroll delta (6) smaller than threshold (120)

The problem is fixed by starting the client with the argument „––yscroll 6“ which sets the scrolling threshold to 6.

Autostart synergy in Ubuntu

There is a howto that describes how to start synergy with gdm so you can use synergy even at login time. This way you can put away the client’s keyboard and mouse altogether and just take them out when something went wrong.

Mac keyboard on linux client

When using my Macbook Pro for keyboard and mouse input I had problems typing special characters in the linux client, that are reached using the Alt or Option key. Linux uses the Alt key completly different so typing the „@“ (option + l) was impossible. You can fix this by first changing the keyboard model in ubuntu to „Macbook/Macbook Pro“ (use Intl model when you have an international keyboard layout).

Now you need another key for reaching these third level keymappings. I use the „keypad enter“ between the right apple key and the cursor keys on my keyboard. Thankfully linux already has an option for that. Using Ubuntu you open your keyboard preferences, on the „Layouts“ tab you open the layout options, there you open the options for „key to choose 3rd level“ and check „Enter on keypad“. You can even make this setting system-wide. After that, you can use the „keypad enter“ key just as the option key in OSX to type those special characters.

Schreibe einen Kommentar