Synergy - Sharing keyboard and mouse across multiple systems
Table of Contents
1. Overview
Synergy is a software tool that allows networked computers to share a single keyboard and mouse. Synergy works on Linux, Windows 95/98/Me/NT/2000/XP), and Mac OS X 10.2 and higher.
Synergy allows cutting and pasting clipboards between systems – simply select and copy on one system, and paste on another.
2. Server
A single machine acts as the synergy server. This machine has a configuration file that defines the screen layouts to use.
My setup has 4 systems on my desk from left to right as follows:
- legolas (dual boot Debian linux/Windows XP laptop)
- gollum (Debian linux workstation)
- sauron (Windows XP workstation)
- gimli (dual boot Debian linux/Windows XP Eee PC)
I use gollum every day and this machine is set up as my synergy
server. The other machines power on and off as required. I use the
single keyboard and mouse connected to gollum to access all of the
machines simply by moving the cursor to the appropriate screen.
If my cursor is somewhere on gollum's screen and I move it off the left edge it ends up on the legolas laptop. Simply driving the cursor off the screen edge moves the keyboard and mouse focus to the next system.
If a system is missing (say sauron is off) then moving right from gollum goes directly to gimli.
Here is my configuration file on gollum that defines the screen layouts. This simply defines the four systems and how they are related to each other. You can position screens side by side, vertically, or whatever makes sense for your working environment.
~/.synergy.conf
section: screens
gollum:
legolas:
sauron:
gimli:
end
section: links
legolas:
right = gollum
gollum:
left = legolas
right = sauron
sauron:
left = gollum
right = gimli
gimli:
left = sauron
end
section: aliases
legolas:
saruman
end
section: options
switchCorners = all
switchCornerSize = 50
screenSaverSync = true
end
3. Client
All of the other systems you want to connect to are clients. They run
the synergyc client program and specify the name of the server as
the single parameter.
After creating a server configuration file and starting the server on gollum you can run a synergy client on another machine simply with
synergyc gollum
4. Setup
4.1. Windows Setup
Download and install the synergy package from Sourceforge.
Start the synergy program from the desktop icon. To set this up as a client system select 'Use another computer's shared keyboard and mouse (client)' and enter the name of the server system (gollum in this example)
To autostart synergy on boot click the AutoStart... button and
select When Computer Starts
Finally start the synergy client now by hitting the Start button.
4.2. Linux Setup
Install the synergy client and server code (the synergy package on
Debian).
4.2.1. Gnome Desktop Environment
To get synergy set up before you log in you need to enable the synergy client when displaying the login screen and then kill it and restart it as the user that logs in.
This requires a few simple changes to the gnome gdm startup files as follows:
- Starting synergy for the login screen
Edit the
/etc/gdm/Init/Defaultfile to start the synergy client for the initial login screenAt the top of the file add the following three lines (replacing
gollumwith your server host name)/usr/bin/killall synergyc sleep 1 /usr/bin/synergyc gollum
- Starting synergy in the user session
Edit the
/etc/gdm/Xsessionfile to kill any existing synergy client and start a new one for this user as follows:/usr/bin/killall synergyc sleep 1 /usr/bin/synergyc gollum
- Cleanup
It's a good idea to kill the synergy client when the session ends (but in case that fails we also kill it in the previous two sessions too)
Edit the
/etc/gdm/PostLogin/Defaultfile to kill any synergy client when the user logs out.Add the following two lines to the top of the file:
#+begin_src sh /usr/bin/killall synergyc sleep 1 #+end_src sh
That's it - just logout and in again to try out your new setup.