Wednesday, September 12, 2012

Cross-platform Synergy

 Synergy

   Have you ever had two different computers side by side and wished you didn't need 2 mice and keyboards? I have. A while ago I coincidentally came across Synergy. This cross-platform tool allows one to control several computers with 1 mouse and 1 keyboard. Bonus: it's completely free. My Debian laptop is sitting to the right of my dual monitor Win7 setup and I can now effectively use it to browse internet, as well as copy-paste code to and from it. Yes, you heard it right, Synergy allows to share the clipboard between the systems.



So how do you enjoy all that goodness? You go to the Synergy Download Page and get the package you need. In case of Debian/Ubuntu though, I would advise going into the package manager and getting a more recent version straight off your repository. Here is the command for your terminal:

sudo apt-get install quicksynergy

(quicksynergy is the graphical front-end of Synergy and will come in handy)

 The only problem at the moment I have with the tool is that, unlike Ultramon, it doesn't allow you to precisely position monitors relative to each other.

Now, I have encountered an interesting case while working with it. In order for me to completely get rid of the need to use my Debian keyboard & mouse, I would need Synergy to run prior to the user login. Unfortunately the developer's website doesn't provide a coherent advise on how to do that(the advice simply doesn't work). After a little bit of research I have found out how to do just that.

Getting Synergy to run at startup. 

Open terminal as root or predicate commands with sudo (super user). We will have to edit a config file of X-server.

This code will launch the editor

gedit /etc/gdm3/Init/Default
If you're under Ubuntu, use sudo gedit. This will open configuration file for your convenience in a graphical editor. Substitute gedit with the editor of your choice. Then you insert the following code into the file
 
SYNERGYC=`gdmwhich synergyc`
if [ "x$SYNERGYC" != "x" ] ; then
"$SYNERGYC" --name DEBIAN 192.168.1.111
fi

making sure it is right before

sysmodmap=/etc/X11/Xmodmap

This code starts a synergy CLIENT(hence synergyC as opposed to synergyS in case of server) at the earliest stage of startup with the name DEBIAN that will try to connect to the server at the IP 192.168.1.111
You of course will have to change DEBIAN to the name that you want to use and the IP to the IP address of your synergy server.

Save the file and reboot the machine. Assuming your server is already setup, your mouse should now be able to work everywhere.

Important Notes:
1. The client will be running as root and WILL have access to your clipboard. Original developer suggests killing the client process after login and restarting it under user in order for the clipboard to work, but I found that it is not the case in Debian.
2. The fix will most probably be broken with the next X11/GNOME/KDE update.

Any comments or questions are welcome.

No comments: