Saturday, 21 August 2010

Stopping random cut-and-paste errors

Recently I've kept finding random bits of text pasted in at random places in the documents I've been editing under Ubuntu Linux.  Today I realised that my new laptop has a middle mouse button, which pastes the contents of the cut-and-paste buffer.  Time to disable that middle mouse button...

It turns out that the laptop has three middle mouse buttons: one below the trackpad, one above the trackpad, and one on the external Bluetooth mouse: invoked by pressing the scroll wheel.

So, how to disable all three middle mouse buttons?  Well there's no preference setting for that in the GUI, but a quick Google search reveals that there's a command-line tweak that's fairly painless.  Chapter and verse can be found in this  Ubuntu Wiki Article, but for my Dell M4400 laptop, the quick answer for Ubuntu 10.04 is to stick three lines down at the bottom of the file ~/.profile (the script that gets run each time you log in) :-
xinput set-button-map 'Microsoft Bluetooth Notebook Mouse 5000' 1 0 3
xinput set-button-map 'AlpsPS/2 ALPS DualPoint TouchPad' 1 0 3
xinput set-button-map 'DualPoint Stick' 1 0 3
I'm not yet certain whether the ~/.profile file is the right place to put these lines.  I'm not certain whether it gets executed unless you fire up an terminal window (as opposed to firing up a text editor or email client as soon as you log in).   I'll update this note if I discover that it needs to go elsewhere.

No comments:

Post a comment

Spammers: please stop wasting my time. All comments are moderated before publication.