Synergy: A software KVM switch (without the “V”)

A good friend of mine and fellow technology wizard has on several occasions brought up Synergy as a great solution for doing work spanning a couple of local workstations.

I know I have several times added it to my “Mental List Of Apps To Try”, but somewhere along the way I forgot about it. Last weekend Jered was over at my house for dinner and he brought it up again, and this time I installed it.

To make a long story short: I should have been playing with Synergy a long time ago!

For those who like to read a little bit more than that, continue, because I have a writeup.

What the heck is Synergy for?

I remember back when I first used the Opera browser (back around 1999-ish). It had a feature that was front-and-center that I’d never seen before, and frankly I didn’t know why anyone would want to use it.

It was tabbed browsing. However, after only a day or two of use, I realized that this was the best browser feature I didn’t know I needed! After that, any browser that WASN’T tabbed felt broken and limited to me (which meant pretty much every other browser available back then felt broken and limited to me).

Synergy, as you may already have guessed, is one of those applications. It’s a great piece of seamless functionality that I never knew I needed until I started using it just the other day.

I do most of my computing on my desktop machine, which is a Slackware box. However, I’ve been doing a lot of work with and writing about Ubuntu lately, and that’s on my laptop. My current setup has my laptop on a TV tray next to my desk in the room of our house my lovely wife and I use as our office. My desk has limited surface area, hence the TV tray. Because I’m constantly doing things on both machines, I’m always switching between my regular keyboard for my desktop machine and my laptop’s keyboard, and likewise with the two mice.

Synergy eliminates that switching. With Synergy installed, if I need to do something on my laptop, I merely move my mouse all the way to the left of my screen on my desktop machine, and it magically appears on my laptop’s screen. While over there, the keyboard only types to the laptop as well, and, as I discovered just today, even the clipboard works for pasting information back and forth between the two machines!

In short, it makes my laptop an extension of my desktop machine.

Get it. Set it up.

On my laptop, which is running Ubuntu 9.04 (sorry guys, I refuse to use the goofy names they come up with for each fricking Ubuntu release. Sue me.), I installed this like I install almost everything there these days. I opened up a terminal window and typed:

sudo apt-get install synergy

On my desktop machine, which is currently running a bastardized rendition of Slackware 12.1, I downloaded the source from Synergy website and extracted the synergy-1.3.1.tar.gz file locally and opened a terminal in that directory. From there it was the usual process of building an application from source.

make install

I found this, which was helpful in getting things started.

I then created a config file for Synergy, /etc/synergy.conf. In it, I designated the two machines where Synergy would be running. “Vectra” is the hostname of my Ubuntu laptop, and “Azalin” is the hostname of my Slackware desktop machine. Here’s the text of /etc/synergy.conf as I have it set up:

section: screens
section: links
      right = azalin
   left = vectra

The next thing I did was to have Synergy start up automatically on both machines, with my desktop (“Azalin”) as the server and my laptop (“Vectra”) as the client.

On my desktop machine, I added the following line to my /~/.fluxbox/startup file:

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

This starts up the server-side of Synergy and tells it to run as a daemon (in background), referencing my config file for it.

Then, on my laptop, I added this line to my /~/.config/openbox/ file, so as to start up the client side of Synergy there:

(sleep 2 && synergyc -f &

What that setup does

The way I have that set up, as I described in the previous section, causes my mouse to flow seamlessly from my screen for my desktop computer (“Azalin”) to the screen of my laptop computer (“Vectra”), simply by moving my mouse cursor all the way to the left side of my desktop screen. It disappears from my desktop machine and reappears on the right-hand side of my laptop’s screen.

While it’s over there, my keyboard acts like it’s attached to my laptop too, and I can even highlight things, copy them, go back to my desktop machine, and paste them from the clipboard in this way.

As a matter of fact, while writing the previous section of this post, that’s precisely what I did to get the line I inserted into my /~/.config/openbox/ file.

While Synergy doesn’t eliminate the need for multiple screens, in the keyboard and mouse respect, it can take the place of a KVM switch. I’ve found it particularly useful when I’m working on multiple things at once on both machines… I don’t have to switch keyboards or mice when going back and forth… all I do is move my mouse cursor all the way over to the left-hand side of my screen and turn my head a little to look at the other screen.

Synergy is one of the best applications I didn’t know I needed. If you work on multiple machines — particularly a laptop in conjunction with your desktop machine — Synergy is an easy setup and an elegant solution to efficiency in multitasking. Even better, it works on Windows, Linux AND Mac OS… though to be fair, I have only tested it in Linux.

I did, however, feel that this was too much fun to keep to myself, so I thought I’d share it with anyone else who happens to be reading my blog lately. Hope you find it useful!

8 thoughts on “Synergy: A software KVM switch (without the “V”)

  1. Hey thanks for the props. I myself have tested it extensively on the windows side (Server 03, 08, Windows 7, Windows XP)

    And used a windows Linux mix without indecent.

    One more note I would make is that the clipboard is text only not folder or file.

    Good to see you like it!

    • Yeah, I tried out pushing just how much the buffer gets cross-utilized and discovered the “text only not folder or file” limitation. But hey, you gotta try, right?

      One thing I keep having to do, however, as a downside, is kill -9 and restart the “synergys” on the machine I have acting as my Synergy server (my desktop machine). It doesn’t throw any errors, it just stops working periodically. Ever run into that?

      A kill and a restart of it fixes the problem…. until it happens again (just plain stops working).

  2. I started using Synergy daily in July this year. I use it all the time, about 8-9 hours each day.

    My configuration is a Linux-Linux one with KDE4.2.4 on both machines.

    I can say that it usually dies between 2 and 20 times a day. I couldn’t figure out what is the cause of it, but it dies. Most of the times it’s the server, but sometimes the client’s synergyc process just disappears.

    After a few days i figured out that it would much easier to write a script and add it’s command to the .bashrc of the user. So I ended up with a single command which does an “su”, finds the synergys process, “kill -9” it, goes back to user and starts the process again with the specific config file.

    But, I have to tell you, that aside this problem, Synergy is a great product and it’s one of its kind. Most of the time it works as expected.

    I also have a suspicion that the clipboard content and/or quantity may have something to do with the problem. I think of this, because I had many crashes of the server when I run on both machines a VirtualBox with WinXP inside and I frequently copied something into the clipboard from one XP, which clipboard gut transferred to Linux, than to the other Linux, and finally to the other XP … in this situations it crashed a lot more than without the XP virtual machines in use.

    • Actually, I notice it seems to happen most often when it’s not in use for a while, where I’m working just on the server machine for a half hour or so, then I try and mouse over to the client and it just doesn’t work.

      Because of that, I have yet to “catch it in the act”, as it were.

  3. Pingback: Remote X « The Linux Critic
    • Good to know… I’ll make a point to check that out. I’ve found some weirdness occasionally in the original Synergy, so an alternative is definitely interesting.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s