Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use the mouse wheel a lot to scroll up and down in my documents and files. Having moved from Windows, I didn't realise that the middle mouse button/wheel, when clicked, pastes highlighted text where the mouse is pointing.

I've been hit with this several time, where my scripts have failed because of a paste that takes me a while to discover.

After several attempts at disabling the middle mouse button, I succeedded with:

xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9"

I found this on this site, which also states how to persist it.

The problem with this feature, is that I rely on other elements of clicking the middle mouse button such as opening links in a new tab or closing a tab in my browser (to name 2 of a few).

It is annoying me that I have lost these functions. How can I disable pasting but keep all the other uses of middle mouse button clicking?

* Please note I am reasonably new to Ubuntu and Linux and have also read about patching the kernel, but I don't feel confident doing this!! *

share|improve this question
If your mouse records middle clicks while you just want to scroll, I'd suggest you to try another mouse model (probably one with a higher pressure to click the wheel). After several years of Linux use I've never been bothered with your issue, actually the middle click paste proved itself to be quite useful :) – Maxime R. Jan 12 '12 at 14:50
There is nothing wrong with the mouse, the force to click the wheel is normal. I think it is the force and velocity at which I can scroll sometimes. Hence why I get pastes without noticing in random places in my files. I also don't think I will use the middle click to paste as I am used to my current method and switch OSes all the time anyway.... – neildeadman Jan 12 '12 at 14:52
possible duplicate of How do I disable middle mouse button click paste? – htorque Jan 12 '12 at 20:48

2 Answers

Somehow, I ended up without any xmodmap files on my Ubuntu install, so I had to find a different approach to this problem.

Take a look at the xinput command.

xinput list | grep -i mouse

which lists information about your mouse. It shows my mouse is "Dell Premium USB Optical Mouse" and also that I have "Macintosh mouse button emulation". Armed with that info, I can

xinput get-button-map "Dell Premium USB Optical Mouse"

which gives me a listing that looks like

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Here is the useful, required knowledge. My mouse has, theoretically, 18 buttons. Each button's default action has the same name as it's button number. In other words, button 1 does action 1, button 4 does action 4, etc. Action 0 means "off".

The position in the listing shows the function assigned to that button. So if my button map read

1 3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

this would mean button 1 (position 1) does action 1 (normal left button), button 2 (position 2) does action 3 (middle button) and button 3 (position 3) does action 2 (right button).

To make a left handed mouse all you would need would be a button map that starts

3 2 1 4 5 .....

Or, in your case, it looks like you want the middle button to do the same thing as button 1 (left button) so your map needs to start

1 1 3 ....

I'd reset my mouse button mappings thus:

xinput set-button-map "Dell Premium USB Optical Mouse" 1 1 3 5 6 6 7 8 9 10 11 12 13 14 15 16 17 18

In your case, you may have a different number of mapped buttons and have some special button map already defined. Likwely, your mouse has a different name, too. First, get your mouse's "name". Then, use the get-button-map operation to find your base button map. finally, use the set-button-map option, modifying button 2 to do action 1.

This is not a permanent change. I added the necessary code to my .bashrc so it executes every time I login or open a terminal.

Hope this helps.

share|improve this answer
Thanks for the info. It explains a little more about the mouse buttons and the actions applied to them. However, it isn't the solution I am looking for. If you left-click a tab in Chrome (to use my example) it selects it (if not selected already). Clicking it with the middle button, will close it (i.e. without clicking the X). I also miss middle-clicking a link to have it open in a new tab for later reading. I realise I can overcome these with alternatives but I am used to this way of working.... – neildeadman Jan 12 '12 at 14:18
Just a thought; any of the other buttons on your mouse, mine say I have 18 buttons though I have yet to physically find more than about 8 of them) may be the function you want. Try mapping other buttons to your third button and see if you find something useful. – Wes Miller Jan 13 '12 at 13:04
If you remap as a two button mouse, it shouldn't change the wheelfunction since the wheel rolls are pressing button 5 and 6 (or 7 and 8 or something like that). – Wes Miller Jan 13 '12 at 13:09

You might want to try emulating a two button mouse. With a two button mouse you paste by clicking both mouse buttons at the same time (rather then the scroll wheel).

Install gpointing-device-settings:

sudo aptitude install gpointing-device-settings

http://live.gnome.org/GPointingDeviceSettings

share|improve this answer
Will this still allow me to scroll in apps (such as Chrome) with the wheel though?? I'll give it a try, thanks! – neildeadman Jan 13 '12 at 8:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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