Gentoo Wiki




Synergy lets you use one keyboard and mouse across multiple computers. To do so it requires that all the computers are connected to each other via TCP/IP networking. Most systems come with this installed.

This tutorial follows the general layout of [1], but with Gentoo-specific commands.

Choose a server

Synergy runs on a server, called the primary screen. The mouse, keyboard and monitor are connected to this computer. The secondary screens all connect to the primary screen. There are no differences in the synergy packages for servers and clients.

!! This is not the correct way of installing synergy it doesn't not function as documented, for proper documentation please see Synergy (Autostart) !!


Install synergy on all computers:

emerge -av synergy


Synergy is configured with a plain text file. A well-commented sample configuration is provided, making this HOWTO almost completely useless.

nano -w /etc/synergy.conf

Here's the listing of my synergy.conf:

section: screens
section: links
               right = berlin
               left   = paris

Note: These names are Case Sensitive.

Now start synergy server (synergys) in the foreground to see if your configuration works. One possible source of trouble lies in the fact that synergy only interprets hashes as comments if they appear in the first row. Fortunately, it gives a precise line number if an error occurs (in nano, press F11 to see what line you are on). Run synergy as user, not as root.

synergys -f --config /etc/synergy.conf

Start the clients

To start the clients, execute the following command, again as user, not as root:

synergyc -f hostnameofserver

The hostname of the server is taken from the /etc/hosts file.

Starting everything in the background

If everything works as expected, you may start synergy in the background. First, kill the foreground processes with CTRL+C. Then, start the background processes:

(server) synergys
(client) synergyc hostnameofserver

Extra configuration options

Synergy has several extra configuration options. For example, add these options to make synergy switch only if the mouse cursor remains for 750ms at more than 100px from both corners:

section: options
       switchCorners = all
       switchCornerSize = 100
       switchDelay = 750

Setting up an init script

As root, Create the following file(s): /etc/init.d/synergy and /etc/conf.d/synergy

# /etc/init.d/synergy
# $Header: $

depend() {
       use xdm net

start() {
       ebegin "Starting synergys"
       # the following line might be necessary to allow the connection to the x-server
       export XAUTHORITY=/home/${SYNERGY_USER}/.Xauthority
       start-stop-daemon --start -b -v -p /tmp/ -m -c ${SYNERGY_USER} -x ${SYNERGY_EXEC} -- ${SYNERGY_OPTS}
       eend $? "Failed to start synergys"

stop() {
       ebegin "Stopping synergys"
       start-stop-daemon --stop -x ${SYNERGY_EXEC} -p /tmp/ -q
       eend $? "Failed to stop synergys"


#Usage: synergys [--address <address>] [--config <pathname>] [--debug <level>] [--display <display>] [--name <screen-name>] [--restart|--no-restart] [--daemon|--no-daemon]
#Start the synergy mouse/keyboard sharing server.
#  -a, --address <address>  listen for clients on the given address.
#  -c, --config <pathname>  use the named configuration file instead.
#  -d, --debug <level>      filter out log messages with priorty below level.
#                           level may be: FATAL, ERROR, WARNING, NOTE, INFO,
#                           DEBUG, DEBUG1, DEBUG2.
#      --display <display>  connect to the X server at <display>
#  -f, --no-daemon          run the server in the foreground.
#*     --daemon             run the server as a daemon.
#  -n, --name <screen-name> use screen-name instead the hostname to identify
#                           this screen in the configuration.
#  -1, --no-restart         do not try to restart the server if it fails for
#                           some reason.
#*     --restart            restart the server automatically if it fails.
SYNERGY_OPTS="-f -a --display ':0' -n gentoo"

The Synergy programs need not (and should not) run as root; therefore, fill your own user name in place of the the SYNERGY_USER variable. It is advisable to create a separate user to run synergy as.

The SYNERGY_EXEC and SYNERGY_OPTS variables will be different depending upon if this machine is a client or server. Client machines will use "synergyc" and server machines should use "synergys."

Modify the SYNERGY_OPTS to what you see fit, the '-f' option needs to be there so that the start and stop functions work correctly. If synergyc is to be run, make sure you include the host name of the synergy server as the last argument.

Now you need to make the script executable

chmod +x /etc/init.d/synergy

Add the script to the default run level with this:

rc-update -a synergy default

See also

Retrieved from ""

Last modified: Thu, 11 Sep 2008 07:13:00 +0000 Hits: 14,748