> 12th March 2009, 02:10       Duss

updated: > 29th July2009, 02:54      [Ubuntu 9.04]

Synergy patch for Linux

Synergy is a great utility to control multiple machines with a single keyboard / mouse. Unfortunately, it seems that it is not developed anymore.

It requires a single machine to work as server and zero or more clients: although having zero clients defeats the purpose of this utility, it is in fact a normal scenario, as the specified clients could be powered off.

In my normal setup, Vista x64 is my synergy server, and I run a few clients with Vista, XP, OS X and Ubuntu. Handling the Ubuntu system with the synergied input, I have usually a few problems:

  • Wheel scroll not working. However, this is due to my Vista configuration, where I have installed specific software to handle the mouse (Microsoft Intellipoint). Without this program, wheel scrolling is all but smooth, so I prefer setting the software to slow vertical scrolling speed. As a result, wheel scrolling is too subtle for the synergy client. Namely, it makes vertical scrolling to use a delta value of 30, while synergy expects at least 120 (whichever units this is measured).
  • Wheel (middle) button not working. Again, this is a side effect of Microsoft Intellipoint, where the wheel button can be configured to perform any action. This can be easily handled by setting the given action as 'middle-click'. I guess that the equivalent Logitech software (or Cherry, etc), can be configured in similar ways.
  • Some keys are not auto repeating. At least, this includes: left arrow, down arrow. This is a well known bug in Ubuntu. Initially I thought this could be a specific KDE configuration problem (easily solved using xset), but that is not the case, as the repetition issue does not appear on the directly attached keyboard.
  • Global auto repeating interaction. If other keyboard is attached to the Ubuntu system, the keys autorepeating feature is automatically disabled when the synergy focus is moved to a different machine. Again, this is a well known Ubuntu bug. This is specifically programmed in Synergy: 'turn off auto-repeat. we do this so fake key press events do not cause the local server to generate their own auto-repeats of those keys'. Unfortunately, turning it on or off is a global setting, so any attached keyboard is therefore affected. Note that, if we are running only the client side, there is no need to perform this hack, and it is possible to disable the current behaviour.
  • Synergy mouse does not wake up the Ubuntu client monitor.

Modifying synergy is a pretty easy task, as the code is really clean. This patch solves the previous problems for the client synergy utility in Ubuntu. More specifically:

  • Wheel motion's precision is definable in command line.
  • If auto repeating is on, left and down keys do correctly auto repeat.
  • The global setting for auto repeat is not modified at any moment.
  • The client monitor is automatically enabled when the mouse enters the screen. This is definitely not the same as to wake up the screen if there is mouse/keyboard activity on the client, but it is enough for most purposes.

There are still additional problems on the linux application. As this bug describes, there can be responsiveness issues: the mouse seems frozen at moments. Fortunately, there is a solution for this problem: running synergyc as root (which is definitely not the best approach).

Download binary

These binary have been built on Ubuntu 8.10, 32bits, and Ubuntu 9.04, 32 and 64 bits, using the same instructions as detailed below. You can copy it into /usr/bin/synergyc

  • synergyc for Ubuntu 8.10, 32 bits: Version 12th March 2009, md5sum: 8c1e87248db7e06cfcfebf6394a06072
  • synergyc for Ubuntu 9.04, 32 bits: Version 29th July 2009, md5sum: a8d162e0c81a051e5c70f8653f9cecaf
  • synergyc for Ubuntu 9.04, 64 bits: Version 29th July 2009, md5sum: a9deba67babda9da0b8cb081b281afc3

Download patch source

This patch has been created on the synergy sources version 1.3.1, available in sourceforge.

To download the sources and the patch, and build it, you can use the following code, on any temporary directory (please see the notes below on the required Ubuntu packages):

wget http://downloads.sourceforge.net/synergy2/synergy-1.3.1.tar.gz?use_mirror=mesh
tar zxvf ./synergy-1.3.1.tar.gz
wget http://www.coderazzi.net/linux/synergy.patch/synergy-coderazzi.patch
cd synergy-1.3.1
patch -p1 -i ../synergy-coderazzi.patch
./configure -x-libraries /usr/lib -x-includes /usr/includes
find . -type f -name Makefile | xargs perl -pi -e "s/-Werror//g"
make
sudo cp ./cmd/synergyc/synergyc /usr/bin

Please note that, when building the source in Ubuntu, two packages are needed, which can be installed as:

sudo apt-get install libxtst-dev
sudo apt-get install build-essential

Usage

The patched version of the synergy client admits a new optional argument, --yscroll, that defines the minimum expected wheel delta. My normal command line starts it as:

synergyc --yscroll 30 lianli

If this value is not defined, the default one -120- is used; if this happens to be too much, the mouse's wheel will not be able to produce scrolling movements on the client. The synergyc program informs of this situation with messages such as:

WARNING: CXWindowsScreen.cpp,825: Wheel scroll delta (30) smaller than threshold (120)

In this case, just restart the synergyc program with the provided delta