I'm running Ubuntu 14.10 in VirtualBox under OSX and for some reason pasting with the middle mouse button stops working after a while. If I start a new rxvt pasting works fine but after a while (I'm unsure how long) pasting with the middle mouse button no longer works (in any program).

I can see with xsel that the text is copied and I can see with xev that X receives "button 2" when I press the button (which is actually remapped to Command_R in OSX). When I start a new rxvt-instance then pasting starts to work again (for a while) in all open rxvt-windows. Starting an xterm also gets it to work again, but starting xclock does not. So it seems like someone removes the paste function from the button 2 event, and that it is re-added when a terminal is started.

Any ideas on how to debug this?


I wouldn't count this as an answer, and I don't have the rep to comment, but if you haven't seen it already, this page and this other question might at least help get you going in the right direction. I'm not sure what the problem is exactly, but if it's an issue within Ubuntu, you may be able to write a script to remap the middle mouse button, and if it's an issue with the VMWare, modifying the .vmx file might work, at least as a workaround solution.

  • Thanks, but I'm pretty sure that this is not a key remapping problem or a VM problem because I can see with xev that X does indeed get the "button 2" event even when paste stops working, so it is not the event that gets lost but rather the paste action itself. Either the paste action is remapped to some other key temporarily, or it is disabled altogether, or button 2 is remapped to some other function temporarily. – Per Knytt Mar 2 '15 at 7:25
  • Damn. Well, I don't know much about this stuff, but this seems like a pretty strange problem. I hope you figure it out. – Jasper Mar 2 '15 at 7:34

Mystery solved! I use "xkbset m" to enable keyboard keys to emulate mouse buttons. It turns out that this operation has a timeout (not documented in the horrible man-page) so this was what made the paste operation stop working. Since I ran "xkbset m" in my .bashrc that was the reason things would start working again whenever a new terminal was started. It is still somewhat of a mystery to me why xev still sees the button 2 events on the key since that sort of indicates that X still gets a mouse button event from the Command_R key.

Anyway, this fix was to replace "xkbset m" with "xkbset exp =m".

I found the solution here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.