Hardware

Clear some desk space with cross-platform keyboard and mouse sharing app

Vincent Danen has found that the cross-platform Synergy+ keyboard and mouse sharing application clears off enough desk space to make room for all new clutter! Here, he tells you how to get it and how it works.

I am, as my wife repeatedly points out to me, a bit of a clean freak for everything in the house -- except my desk. My desk is constantly covered in bits of paper, books, note pads, various gadgetry, and other little knickknacks.

Unfortunately, that also includes a number of monitors on top of the desk, the two towers beneath it, two keyboards, and two mice. And since I'm such a messy desk person, the more space I have for clutter, the better. The second keyboard/mouse duo on the desk does not help matters very much at all.

So it was with great interest that I found a project called Synergy+ that will share the one keyboard and mouse that exists in the keyboard tray, with both computers. The original Synergy project has been abandoned, but Synergy+ was forked from the original Synergy project, and work is progressing on it.

The cool thing about Synergy+ is that it is cross-platform. That means that your primary computer can be Windows, Linux, or OS X and so can any of the other computers that you want to share the keyboard and mouse with. And the really nice thing is there is no need for additional cables or KVM switches -- if the computers are networked together, that is all the connection required.

Synergy+ works on a client-server architecture. So the primary workstation, to which the keyboard and mouse are physically (or wirelessly) attached acts as the Synergy+ server, whereas the other systems will act as the Synergy+ clients.

To start with, on the server, you need to create a synergy.conf configuration file that indicates what the clients' hostnames are, and where their monitors are in physical relation to the server's monitor. For instance, we have two computers: server and client. On the computer named server, synergy.conf would contain:

section: screens
  server.host.com:
  client.host.com:
end
section: links
  server.host.com:
    left = client.host.com
  client.host.com:
    right = server.host.com
end

This indicates that the client system is positioned to the left of the server. So when the mouse hits the left-most edge of the screen on the server, it will trigger a mouse movement (and receiving input from the mouse and keyboard) to the client's right-most edge of the screen. If you wanted to add a third system in there, you could; just update the configuration file and position it accordingly in the links section.

On the server, you will want to start Synergy+ using:

$ synergys --config /path/to/synergy.conf

On the client, all you need to do is tell the Synergy+ client executable the name of the server:

$ synergyc server.host.com

Of course, none of this is useful if you have to use a keyboard to start the client, or ssh into the box in order to launch Synergy+. So on the client system, you can add the following to start synergyc at the gdm login screen (so that you are able to type in your login credentials) to the /etc/gdm/Init/Default file, at the very end, but before the final exit command:

### start the synergy+ client
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc server.host.com
exit 0

You can do the same with the server, if running Linux, but start the synergys executable instead.

Synergy+ works really well. It still has some minor issues, but it is very functional and reliable for the most part (I have experienced one or two spontaneous exits of the client in the last few weeks). Most importantly, it's allowed me to reclaim the space taken up by the extra keyboard and mouse for the second computer, and fill it with more meaningful random clutter.

Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

7 comments
adun153
adun153

I tried it, it works really well. Thanks! :)

Jaqui
Jaqui

I did it with a single, platform agnostic KVM. I use a 4 port KVM that doesn't require any software installation to drive it. and is completely transparent to the OS. [ as a matter of fact, even xorg's broken automatic configuration tool manages to get the brand name and model of the monitor through it. ]

mvirard
mvirard

That seems cute. I already share a single large Sun monitor between a PC (Windows) and a Sun Solaris box but I have not been able to get rid of the extra keyboard and mouse. I wonder if this Synergy would work on a Sun Solaris as well?

ellisera
ellisera

Sure this sounds great on paper, but if one of those computers is a server or testing sandbox that is having network connection issues, then the purpose seems to be defeated, doesn't it?

wlramsey
wlramsey

I have used Synergy for going on 5 years now. I cannot live without it. I have used it to combine XP and Ubuntu and more recently Windows 7 with Windows XP and Ubuntu. I also use it when I bring my laptop in and combine it with my desktop, so still I only have one Mouse and Keyboard. I could not function without this!

mvirard
mvirard

The 4 port KVM is a good fit for my server cupboard (3 regular PC servers) but for the PC/Sun sharing I was talking about a solution that could handle the Sun funny mouse-keyboard combo (single PS2 connexion) of the Sun. Also, for a desktop setting, I am not too fond of yet adding another set of cables and a box. It is already messy enough. Hence my interest in a pure soft solution. Also the Sun 20" monitor is already a shared device: it has two cables, one for the Sun box (not a standard VGA) and one for a PC (VGA) and a front switch to select the source.

Jaqui
Jaqui

with the non standard sun workstation it makes sense then. but if all the systems have same port / connector setup, the kvm hardware switch often makes more sense. the Starteck model I have has keystroke switching, yet no software installed. or I can use the button on the unit to cycle through the ports to reach the system desired. I always just use the keyboard switching. left control twice then number for the port desired. it's one drawback is that it only supports the ps2 connector for keyboard and mouse. Though it's cabling is 1 cable per system connected. the keyboard/mouse connectors are run out of the vga connector.

Editor's Picks