OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile

March 27, 2007

Software KVM switch : synergy on Linux

by @ 7:06 am. Filed under How-To, review, SUSE Tips & Tricks

Introduction

One thing people really love is desktop real estate. Seriously, it’s a fundamental law of life: “Bigger is better.” Unless you’re referring to like a nail in your head or something. But generally, people like bigger, especially when it comes to their monitors. Lately, I’ve been using this sweet app that doesn’t quite give me a bigger monitor, but it does give me something very similar. It’s called “synergy.”

From the project website: “synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It’s intended for users with multiple computers on their desk since each system uses its own monitor(s).” Translation: pretty much a software KVM switch.

The way it works is that you have a synergy server running on one machine, like your main desktop. You also have a synergy client running on another machine, like a laptop that you have next to you on your desk. When you drag your mouse past the edge of the screen on your desktop, the mouse cursor and current clipboard contents magically appear on the client machine, your laptop in this case.

Using synergy is very similar to having two monitors because you just drag the mouse between the two seamlessly. It is different because the monitor on the client machine is obviously not hard-wired directly to the main desktop, it is still driven by the machine it is connected to (the laptop, in this case). You have two completely separate systems controlled from a single mouse and keyboard. You don’t have to switch to that little tiny keyboard on your laptop or use the touchpad or eraser mouse on it, either. You just slap your mouse over to the edge of your desktop monitor, and it appears on your laptop monitor, and away you go.

The clipboard is shared, as well. If you hit a URL on the laptop that you want to open on the desktop, copy it to the clipboard, drag the mouse cursor back over to the desktop, open Firefox, and middle-click. Done.

What will really kick you in the head is that this program is cross-platform. It runs on Windows and Linux (apparently, not so well on Mac).

synergy is a bit of a paradigm shift to get used to, but when you do, you can’t live without it.

K, I can see that I have your attention, and you don’t want to screw around with figuring out how to make it work. You would like some brief quick-start instructions. So what are we waiting for?

To make this baby go, you need two computers. In my case, the server machine (my desktop) is an AMD 64-bit machine running SUSE 10.1. This machine is called tomahawk. The client machine (my laptop) is an Intel Duo machine running openSUSE 10.2. It is called laptop.

On each computer, do the following:

Install synergy

Open YAST => Software => Software Management. Search for ‘synergy‘, check the box next to it when it comes up, and click ACCEPT in the lower-right corner. synergy is installed accordingly.

Configure synergy

On the client machine, called laptop, I have put an appropriate entry in the /etc/hosts file for the desktop, which looks like this:

[0032][scott@laptop:~]$ cat /etc/hosts
#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1       localhost
192.168.0.110   tomahawk

 

On the desktop, I had to create a small config file called synergy.conf, which looks like this:

[0031][scott@tomahawk:~]$ cat synergy.conf
    section: screens
       tomahawk:
       laptop:
    end
    section: links
       tomahawk:
           left = laptop
       laptop:
           right = tomahawk
    end

 

This file is just in my home directory (/home/scott/synergy.conf, in this case). Where ‘tomahawk‘ appears, that is my desktop. Where ‘laptop‘ appears, that is my… yes… laptop. In this configuration, the monitor on the right is the ‘tomahawk‘ monitor, and the monitor on the left is the ‘laptop‘ monitor. When the mouse is on ‘laptop‘, and it hits the right side, it will disappear and reappear on ‘tomahawk‘. Likewise, when the mouse is on the ‘tomahawk‘ monitor, and we run it off the left side of the screen, it will disappear and reappear on the ‘laptop‘ monitor.

Adjust the contents of this config file according to your setup.

Run synergy

Maybe someone else is more gifted than I am, but I was only able to get synergy working in foreground mode, and it would absolutely not run as a daemon. I did find a way around this, but if anyone else knows how to make it work right, please post a comment here so everyone else can have it, too.

commandline for tomahawk:

[0031][scott@tomahawk:~]$ synergys -f --config synergy.conf > /dev/null 2>&1 & 

 

Basically, run the synergy server in the foreground using ‘synergy.conf‘ as a config file, output everything to /dev/null, and run it in the background (this is the hack part). As far as synergy is concerned, it is running in the foreground, but from the point of view of my shell, it runs it in the background.

commandline for laptop:

[0032][scott@laptop:~]$ synergyc -f --name laptop tomahawk > /dev/null 2>&1 &

 

Run the synergy client in the foreground, identifying itself as the computer called ‘laptop‘, connecting to the computer called ‘tomahawk‘, sending all output to /dev/null, and have bash run it in the background.

Again, if anyone can tell me how to make it properly run in the background, I’m all ears.

You may test it a bit first without the ‘ > /dev/null 2>&1 &‘ at the end of the commandline. This will allow you to see all output. When you can see that it is connecting and working, restart with this extra stuff appended. Then, you will be able to close the terminal windows without synergy shutting down.

I have actually put these commandlines into bash scripts

Conclusion

Once you have this bad fool running, move your mouse around between your two monitors. Copy and paste URLs and other things between the two computers. Before you know it, you’ll have a nice productive setup working for you. I wonder if you can make this thing run between two dual-head systems. Or like twelve. Talk about retinal burn-in.

In case anyone is interested, it also plays nicely with XGL/beryl, which I also have running on my laptop.

All things considered, I enjoy synergy quite a bit, and it has become indispensable for me at home. I run all my always-on stuff on my laptop (thunderbird, gaim, etc), freeing up the resources on my desktop for the tasks at hand. It works out quite nicely.

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

archives:

March 2007
S M T W T F S
« Feb   Apr »
 123
45678910
11121314151617
18192021222324
25262728293031

59 queries. 0.719 seconds