• Category Archives Ubuntu
  • Internet » Ubuntu
  • Synergy2 .. why don’t you have it??

    Posted on by rob

    Ok, let me explain first what it is.. Synerygy2 is a way to share multiple computers with one keyboard and mouse.  No, it’s not a KVM replacement.. Synergy2 replaces only the keyboard and mouse, you’ll need to have a monitor attached to each machine on your desk.  This is actually a plus.  In the photo below you’ll see my working area at the office… I’ve labelled which each runs for an OS and below that the names of the computers (click to see the full size image)


    The keyboard and mouse is actually attached to the Ubuntu machine, in other words that’s the “server”.  The XP and Windows 7 machines are “clients”.  One thing to consider with Synergy is that it’s not secure.  It does send everything you type in plain text over the network.  This can be avoided by tunnelling the connection over something like SSH.  Perhaps I’ll cover that later.  Synergy2 isn’t new, it’s been around a very long time.

    I don’t want to reinvent the wheel or try to take any limelight from those that have already posted great articles on how to set it up, the best information can be found from the Synergy2 website itself.

    What I’m posting about is really how to fix a problem that I’m sure others might have encountered.  Right.. so the problem is this.  As I’ve said, the server is on Ubuntu.  Naturally the “Windows key” on Ubuntu has no natural meaning to the OS, it’s just another key and not mapped to anything out of the box.  The problem I’ve had is that while using Synergy the “Windows Key” didn’t work on the Ubuntu machine even though I’d remapped it to do things, such as Win + T to open a new xterm, Win + R to open the Run Command Dialog (basically making it operate a bit like Windows).   the fix for this was a change in the $HOME/.synergy.ini file on the Ubuntu machine.  The weird thing was that when move the mouse to the XP machine the Windows key did what it should, however on the Windows 7 it wouldn’t work.

    Right, so what was the fix?  Here is my .synergy.ini file

    section: screens
      meta = super
      meta = super

    section: links
    left = scotland
    right = rambler
    right = burma
    left = rambler
    left = burma
    right = scotland

    section: options
    screenSaverSync = true

    The important lines above are the “meta = super”.  Under Ubuntu the Windows Key is called “meta”.  This tells Synergy when the focus is on the windows machines to map the “meta” key to the “super” key, or in other words the Windows key.  Once that was changed and synergys was restarted all was good again.

    I’m posting this for anyone else that might have a problem with the windows key not working under synergy with Linux/Ubuntu/Unix machines and windows machines, but also as a reminder to myself should I forget how I fixed it :)  I’d been through this exercise about 4 years ago but having rebuilt that machine I couldn’t for the life of me recall how I fixed it .. well, now that I’ve blogged about it I’ll at least have one good place to go and find the answer again :) 

  • Ubuntu network location detection

    Posted on by rob

    Ok, it’s not a full location detection as such.. I use my laptop (Ubuntu 9.04) both at home and work, as well as other places.  The problem that I had was related to how SAMBA was configured.  At home I have one workgroup name and at work I want the machine to appear in the company domain.  But also, while out and about in the big bad world I don’t want SAMBA on at all, no need to share anything with anyone.

    So, to over come this and correct it at boot time I’ve come up with the simple script below.  The only other thing you need to do is prepare a couple of smb.conf files to suit the locations you’ll be in.   I have 2 smb.conf files, one for HOME and one for WORK.   I run the script from /etc/rc.local so it runs when I should have networking fully up and running. 

    Here is the script:

    GW=`route -n | grep ^| awk '{print $2}'`
    if [ $GW = $WORK ]; then
        #echo "You're at work"
        cp /etc/samba/smb.conf.WORK /etc/samba/smb.conf
        /etc/init.d/samba restart
    elif [ $GW = $HOME ]; then
        #echo "You're at home"
        cp /etc/samba/smb.conf.HOME /etc/samba/smb.conf
        /etc/init.d/samba restart
        #echo "You're somewhere else"
        /etc/init.d/samba stop

    Pretty simple really.  Hope others will find it useful.