About four years ago when I ran Windows XP on my main desktop PC I used a small bit of software named Middle Mouse Button. It reassigns the middle button of a mouse to act as a left double-click (or right double-click if you use a left-handed mouse). On modern computer mice the middle button is usually part of the scroll wheel, ie. you press the wheel down to use it. I forgot about this feature after I switched to Ubuntu.

I also bought a Logitech TrackMan Marble a short while after switching to Ubuntu. The Marble was okay, but quite bulky. It has several buttons, but no middle button, and no scroll wheel. Scrolling web pages up and down required holding a button down then using the trackball, which wasn’t ideal, and which isn’t the default in Ubuntu. It took me a bit of Googling to work out how to configure that behaviour. The commands I ran at startup were:

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

xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 8
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1

Lately one of the Marble’s buttons started to become unresponsive, so I bought a Logitech MK270 wireless keyboard & mouse. The mouse has a middle button on the scroll wheel, which reminded me of my old mouse setup in XP. I wondered if I could use the middle button to double-click Ubuntu. Some Googling later, I came across the Mouse Customizations page on the Ubuntu Help site.

To cut a long story short, in Terminal, run the following command:

sudo aptitude install x11-utils xbindkeys xautomation

Then run:


Move cursor to xev’s window, hold the mouse still, click in the window using the button you want to reassign, and look at output in the Terminal:

ButtonPress event, serial 36, synthetic NO, window 0x3a00001,
    root 0x112, subw 0x0, time 405119162, (103,107), root:(106,165),
    state 0x0, button 8, same_screen YES

ButtonRelease event, serial 36, synthetic NO, window 0x3a00001,
    root 0x112, subw 0x0, time 405119311, (103,107), root:(106,165),
    state 0x0, button 8, same_screen YES

On the third line xev is telling me it’s “button 8“.

Now edit ~/.xbindkeysrc:

gedit $HOME/.xbindkeysrc

and add the following lines:

"/usr/bin/xte 'mouseclick 1' 'mouseclick 1' &"
b:8 + Release

Here, b:8 means button 8, to match the xev button above.

Finally, run xbindkeys:


You need to run this each time you start Ubuntu. You can do this manually (if you remember), or configure it to run automatically from System > Preferences > Startup Applications.

The above should also work on non-Ubuntu Linux distros as well as FreeBSD, etc. with some minor modifications.

Lastly, on my system this xbindkeys setting is also active within all my virtual machines in VirtualBox, as well as over Remote Desktop. Very handy.

Say goodbye to double-clicking.


Leave a Reply

Your email address will not be published. Required fields are marked *

Anti-Spam Quiz: