Arnt Gulbrandsen
About meAbout this blog
2011-10-27

Sharing keyboard across Mac and Linux

Computers are good. More computers are better. But more keyboards are not. Swapping keyboards all the time was how I first ruined my wrists, almost twenty years ago.

That's why now, with a Mac Mini under and a linux box near my working desk, I definitely don't want to use two keyboards. One is the right number, and Synergy is the way to share keyboard and mouse.

I run the Synergy server on the linux box. My server configuration is pleasantly simple. The linux box (libertango) has a horizontal row of monitors, the Mac (called telefon, as video conferencing is its purpose in life) has a single monitor above the linux row, slightly to the right of the middle. Here's the file:

section: screens telefon: libertango: end section: links telefon: down = libertango(50,70) libertango: up(50,70) = telefon end

50-70 on down means that when the mouse moves down from the Mac screen to the linux screens, it ends up slightly to the right of the middle, matching the physical layout, and on up means that the mouse reaches the mac screen only from the same area.

I run the Synergy server in my login file on linux (.zlogin in my case, perhaps .bashrc in yours). On the Mac I downloaded Synergy and built it. At this point I was a little confused, because he Mac didn't show any program called Synergy. But then I found Tor Slettnes' recipe for activating it on the Mac, and all now seems well.

Update: No, not quite all. The Mac is stubborn about the keyboard layout. For some reason I can't have an additional Control key to the left of my A.

Update: The Mac is unhappy in some respects. By default, it nagged me about not having a bluetooth keyboard and mouse at boot time. Deselecting two options in System Preferences → Bluetooth → Advanced took care of that. But trying to attach a bluetooth headset triggers the same nagware, and that's more difficult to eliminate.

Even worse, the Lion screensaver demands a real mouse click to wake up the screen. Synergy's synthetic mouse clicks are not enough. Ideally, just shoving the mouse onto the Mac screen would wake up the mac.

Update: The last straw. The synergy server (on linux) ate 69 hours of CPU time by calling poll() repeatedly with a short timeout and doing no work between each call. The synergy client (on macosx) ate CPU time too, don't know why. I patched the polling bug, then discovered how many open bugs and unaccepted patches there are, and decided I'd rather try something else. I'm typing this via an Aten CS22U, a €13 USB-only KVM. It doesn't give me a shared clipboard and the mouse acceleration differs between linux and mac, but on the other hand I have my CPU back.