Bill Lovett

Working Around Copy and Paste Problems in XWindows

Posted on March 6th, 2006

I had no idea that pressing Shift-Insert in an XWindows environment was the equivalent of clicking on button 2. But it is! And it works in VNC no less!

I've recently starting using VNC to connect to a server running locally inside a VMWare virtual machine. Without virtualization, this would be impossible. Since the virtual machine is local though there's no threat of lag or poor visual quality. Still, it quickly became apparent that copying and pasting was going to be a problem.

Searching Google on this subject brings back many mentions of something called vncconfig, which makes copying and pasting from client to server work. Unfortunately it doesn't seem to exist in the NetBSD world. I did read about the -compatiblekbd option, which when passed as a parameter to vncserver allowed clipboard transfers from server to client. I could copy text inside a VNC session and paste it into another application on the client, but not vice versa.

For whatever reason, the problem was with the way my virtual machine was emulating the buttons on my mouse. It was treating the scroll wheel button the same as a left click. Using the xev utility, I found that I had to click the left and right buttons together in order to get a button 2 click to occur.

This is really inconvenient, because odds are when I try to click both buttons simultaneously I'm going to misfire. While trying to figure out how to remap the mouse buttons, I saw mention of the Shift-Insert combination. I like this much better, because there's no chance of misclicking. Even better, I can copy and paste both ways between VNC server and client.

Back to the index of all blog entries