Getting a True Three-Button Mouse

image link-topic-sf0.jpg

1. The Problem

The X Window System paradigm for using mouse buttons is, in my opinion, one of the most elegant and effective user interface methods ever concieved. It requires a three-button mouse. The first button is the general point-and-select button. The middle button is the "paste" button. The third button is the "pull down menu for more options" button.

If your use of the computer involves mostly text, then there is no better select/cut and paste user interface available.

Unfortunately, computers interfaces are designed increasingly for those who cannot read or write. Like a medieval iPeasant, they can only gawk and point at icons on the signs hanging above shop windows. These people require only one or two buttons. At the same time, the ancient medium of the scroll has been reintroduced, leading to methods for moving quickly through them. This is a truly antiquarian problem that hadn't been seen for over a thousand years - not since the introduction of the codex.

The upshot of all of this is that true three-button mice are almost impossible to find now. Moreover, while almost every real UNIX person has a stash of true three-button mice, they're almost certainly PS/2 interface devices (PS/2 ports are harder to find now) and probably aren't optical (optical mice do have an advantage in the eternal battle against cat hair and cookie crumbs).

There seem at present (2014) to be four solutions:

The first solution (Logitech T400) is rather nice. It does require a bit of configuration for use with Linux (Arch Linux and FVWM in my case). See below.

The second solution is crude but effective, and is a useful fallback in the absence of other methods. See below.

The third solution (ContourMouse) looks beautiful, but it's a bit expensive so I haven't tried it yet.

The production status of the fourth option (DY651A) is not clear; I haven't tried it.

2. Configuring the Logitech T400

The Logitech "Zone Touch Mouse T400" is an interesting device. The middle button is actually a touchpad which also has two (I think two) physical clickable actions to it. You can use it like a scroll-wheel by swiping your finger up and down along it. But you can also use it as a middle mouse button by clicking on it (I think that technically it has two different clicks, one at the far end and one at the near, but I end up remapping them to just one click). In practice this works entirely differently than a wheel. You cannot click on a wheel without either accidentally moving the cursor or cramping up your hand and risking repetitive stress injury. Clicking on the touchpad-middlebutton of the T400, by way of contrast, works just like a plain middle mouse button.

The T400 works in my environment (Arch Linux with FVWM), but it doesn't quite work out-of-the-box.

The first thing I had to do to get it to work was to reboot after I'd plugged the USB receiver chiclet in. It took a hard power-off and on again to get my hardware to recognize the receiver.

At this point, the basic pointing capabilities of the mouse, the left and right buttons, and the scroll capability of the middle button/pad all worked. The middle button click did not.

It would appear that the mouse hardcodes its middle button click to the "Super+L" key (that is, the left "Windows" key on a PC keyboard). It takes two programs to overcome this foolishness: xbindkeys to alter the keyboard binding, and xdotool to reassign it to what it should be. Both need to be installed:

sudo pacman -S xbindkeys 
sudo pacman -S xdotool 

(Aside: xdotool is really quite interesting, and powerful. It's worth looking at in its own right.)

Then configure xbindkeys by creating a file "~/.xbindkeysrc" which contains:

"xdotool click 2" 
m:0x0 + c:133 

Then put an xbindkeys command in your "~/.xinitrc" file to cause this to happen each time you bring up X. In my case, I have this in my "~/.xinitrc":

xrdb ~/.Xresources 
exec fvwm 

Then fully exit X and start it up again. (Just restarting FVWM isn't enough.)

3. Other Useful Mouse Commands

3.1. Finding a Mouse Click Encoding

While figuring out how to configure the T400, I ran across a couple of commands which might be generally useful when debugging such things (especially since the traditional X Window System tools aren't always distributed nowdays).

To query a mouse click, run:

xbindkeys -k 

Wait for it to pop up a little window, then move to that window and click as desired in it. This will return three lines; example (clicking on the T400 middle button):

"(Scheme function)" 
m:0x0 + c:133 

This output is intended as a guide for constructing an entry in "~/.xbindkeysrc". The first line indicates that you should put a command in quotation marks in your "~/.xbindkeysrc". Don't use "(Scheme function)" literally - use the command you want executed. The second and third lines are the things which are supposed to trigger the command (that is, they encode the click you just did). I haven't tried the version in the third line ("Pointer_Button2") because, for me, the second line worked (m:0x0 + c:133). So, using this output as a guide, I created my "~/.xbindkeysrc" file:

"xdotool click 2" 
m:0x0 + c:133 

3.2. Finding a USB Mouse ID

In the end, I didn't have to do anything with the low-level ID number of my T400, but it's always interesting to learn more about your system.

The program "solaar" is used to configure/query the Logitech "Unifying Receiver Device". This is the little chicklet that plugs in to a USB port and receives the signals from the wireless T400. Apparently, it can handle multiple Logitech devices, but will be configured by default for only one (so you need solaar to configure it for more complex situations). The program (solaar) is in the Arch Linux AUR. If you run:

solaar-cli show 

it will return some information about your T400.

But it doesn't really return enough information. The program "xinput" does. I'm not quite sure which package xinput is part of; it was already present on my installation. Do:


to get a tree-listing of all USB input devices. The T400 will show up as "Logitech Unifying Device. Wireless PID ..."

4. Hacking a Three-Button Wheelmouse

There is (as of the 2014-ish timeframe) a very common style of mouse which nominally has three buttons, but which is nevertheless useless: the three-button "wheelmouse."

In such a mouse, the first and third buttons are as they always were. In between them is a wheel which would have been just the thing at the Library of Alexandria (but which is not necessary, and is increasingly less relevant as swiping a touchscreen becomes common). To get the middle button, you press down on the wheel.

The reason that this style of mouse won't work as a proper three-button mouse is that, unless you grip it in ways which will cramp up your hand in minutes and lead to bad repetitive-stress injuries, you cannot click the middle button (the wheel) without rotating the wheel and moving the on-screen location where you're clicking. Using such a mouse is misery.

4.1. The Solution

The solution is very simple: surgically alter the "three-button wheelmouse" so as to disable the input from the rotation of the wheel. With such a modified mouse, the wheel is still there, and probably still spins, but spinning it does nothing. This means that you can simply click it for a proper middle button without damaging your hand.

You do lose the function of the wheel, but that's a small price to pay for having, once again, the most elegant user interface method ever devised for text. (The middle button is also a bit bumpy, as it's still physically a wheel.)

4.2. A Possible Future Solution

Of course, hacking a wheelmouse in this way is a stopgap. What I should really do is design and 3-D print a new cover for a standard existing wheelmouse which just provides a regular middle button with no bumpy disabled wheel at all.

Ultimately, it wouldn't be that hard to design and 3-D print a completely new mouse (probably employing the salvaged sensors and guts of some existing sacrificial 3-button wheelmouse).

4.3. Example 1 (Quick but Flawed)

I presume that there are many different kinds of wheelmice, so each instance of hacking one will differ.

The first time I tried this it was with a generic Chinese wheelmouse (Model SM-1035). In it, the wheel is mounted on an axle which has two "cradle" flanges below it. The left side of the axle sticks into a potentiometer; this provides the wheel function. It also acts as a pivot so that pressing the wheel down pushes the right side of the axle down to contact a microswitch.

In my first hack, I simply cut the axle off so that it didn't go into the potentiometer. This worked - the "cradle" was enough to let the axle act, still, as a lever.

But it is a poor solution as the wheel/axle can become misaligned and, sometimes, stick.

[TO DO: photograph this]

4.4. Example 2 (Better)

A better method, given the internal mechanics of this style of mouse, would be to leave the wheel's axle unchanged and to cut the leads from the wheel's potentiometer.

[TO DO: figure out the details and then do and photograph this]

Select Resolution: 0 [other resolutions temporarily disabled due to lack of disk space]