How to (re)map extra mouse/trackball buttons?


I have a Kensington “Expert Mouse” USB 4-button trackball, and I hear there are a number of pointing devices on the market with extra (programmable) buttons. I’ve done some searching, and a number of methods are described (mostly for Ubuntu) for mapping the extra buttons to draglock and even double-click functions. Meanwhile, users are going so far as to ask in the forums if the Windows software that ships with these devices will run under wine.

I tried the technique of customizing an xorg.conf file to enable draglock, and CL seemed to just ignore it. I also tried installing a Kensington driver package for my trackball, to no avail.

Do any of you devels or experienced users know of a method that works? Both double-click and draglock on the back two buttons would be fantastic, but either function alone would reduce the risk of a repetitive stress injury.


Can you elaborate on exactly (files, locations, content) that you tried? Perhaps there’s a stateless gap here and we haven’t covered our bases. Usually it’s not a huge deal and can be fixed quickly.

I recall that I’m using Xmodkey to rebind a mouse event to a keyboard stroke. I’ve a Logitech mouse but I think it might work for you mouse as well.

I tried installing TrackballWorks 1.3, but interfaces for Windows device drivers open in the Windows control panel, which doesn’t seem to work in wine.

I can reproduce my experiments with xorg.conf, but I have forgotten the command for generating this file from the system’s current configuration, and cannot seem to find it. Would you please remind me? Thanks. :slight_smile:

I managed to find the instructions I used before for generating xorg.conf, so here are the steps I followed:

  1. Open a terminal, log into root
    $ su
    root@Nirgendsdorf #

  2. Create
    # Xorg :1 -configure

  3. Edit, leaving only the mouse section
    Section "InputDevice"
    Identifier "Mouse0"
    Driver "mouse"
    Option "Protocol" "auto"
    Option "Device" "/dev/input/mice"
    Option "ZAxisMapping" "4 5 6 7"

  4. Navigate to Configuring Linux and X for a Kensington Expert Mouse for instructions.

  5. Add a draglock option to
    Option "DragLockButtons" "8"

  6. Save the file and move to /etc/X11/xorg.conf

  7. Restart system and try the mouse. Result: no draglock.

I also tried the commands as they appear in the Configuring Linux and X article, and perhaps adding some commands from the article to what Xorg produced. I also tried moving the file to /etc/xorg.conf. In all cases, CL ignored these instructions and I wound up with my default mouse configuration.

I don’t think you need to duplicate the entire Xorg.conf. You can just drop the InputDevice section into a file in /etc/X11/xorg.conf.d/99-local-input.conf (the name can be anything I think).

And the content of the InputDevice Section? I have what Xorg :1 -configure generated, I have what’s on that web page…? Guess I can experiment…

There are several wiki’s and doc pages explaining with good examples how to do this:


Man pages: xorg.conf

Maybe this can help too: How to configure input

Thank you, I had a look. I do not have the background to relate this information to my specific problem. There seems to be a welter of options for any given input device, but nothing to tell me what to use for the specific purpose. I had better luck searching the web on xorg.conf draglock, but none of the suggested settings that I tried produced the desired results. I’ve searched extensively for solutions related to my specific trackball, and they all leave out essential information that their authors assume “everyone knows.” I have no idea where to turn (no user groups in my area), and cannot afford to pay for support, so I guess I have to give it up. (Could be worse, I suppose—I could be trying to configure the advanced features of a touchpad.) Thanks anyway.

Ah, sorry, I didn’t catch this … critical part. Remapping buttons is normally done through xorg.conf, but what you want is not as simple as … remapping. What you want is for a button to behave differently based on context, and Xorg can only remap consistently. Indeed what you want is some of the synaptics features, maybe that is a thing to look at, but I admit I’m not even sure if it’s even possible or simple, at all.

These articles make it look very simple indeed:

xorg.conf Options

5.4. Drag Lock Buttons

Some people find it difficult or inconvenient to hold a trackball button down, while at the same time moving the ball. Drag lock buttons simulate the holding down of another button. When a drag lock button is first pressed, its target buttons is “locked” down until the second time the lock button is released, or until the button itself is pressed and released. This allows the starting of a drag, the movement of the trackball, and the ending of the drag to be separate operations.

Option “DragLockButtons” “W X Y Z”

This option consists of pairs of buttons. Each lock button number is followed by the number of the button that it locks. In the above, button number “W” is a drag lock button for button “X” and button number “Y” is a drag lock button for button “Z”.

It may not be desirable to use multiple buttons as drag locks. Instead, a “master drag lock button” may be defined. A master drag lock button acts as a “META” key. After a master lock button is released, the next button pressed is “locked” and not released until the second time the real button is released.

Option “DragLockButtons” “M”

Since button “M” is unpaired it is a master drag lock button.

EVDEV(4) manual page

Option “DragLockButtons” " L1 B2 L3 B4 "

Sets “drag lock buttons” that simulate holding a button down, so that low dexterity people do not have to hold a button down at the same time they move a mouse cursor. Button numbers occur in pairs, with the lock button number occurring first, followed by the button number that is the target of the lock button. Property: “Evdev Drag Lock Buttons”.

Option “DragLockButtons” " M1 "

Sets a “master drag lock button” that acts as a “Meta Key” indicating that the next button pressed is to be “drag locked”. Property: “Evdev Drag Lock Buttons”.

Configuring Linux and X for a Kensington Expert Mouse

Section "InputDevice"
Identifier "Generic Mouse"
Driver "mouse"
Option "SendCoreEvents" "true"
Option "Device" "/dev/input/mice"
# /dev/input/mice can emulate plain PS2, ImPS/2 and ExplorerPS/2;
# only this one supports more than 3 buttons + scrollwheel:
Option "Protocol" "ExplorerPS/2"
# scroll wheel Option "ZAxisMapping" "4 5"
# four real buttons and the scroll wheel:
Option "Buttons" "6"
# This bit's optional; it configures button 4 as a sort of 'lock'
# button, so instead of holding down one of the other buttons you
# first press button four then click the other button:
Option “DragLockButtons” “6”

Thing is, none of these solutions work, and I have no idea why.

My first touchpad was a Synaptics; my second was a Cirque CruiseCat. I had to give up on touchpads because my hands perspire too much, which interferes with the electomagnetic fields produced on the surface of the pad.

Besides, given as how I cannot even enable drag-lock on my trackball, How would I ever enable drag-lock and scrolling on a touchpad? What can you do when device drivers in the Linux world do not have simple, straight-forward interfaces to control their advanced features?