Ubuntu – Disabling “back” for a Logitech trackball

input-deviceslogitechxorg

I've got a Logitech Marble Mouse trackball with four buttons:

enter image description here

Using the instructions here, I've got 50-marblemouse.conf (xorg.conf) set up so that the holding the "back" button lets me scroll:

Section "InputClass"
        Identifier  "Marble Mouse"
        MatchProduct "Logitech USB Trackball"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "EmulateWheel" "true"
        Option "EmulateWheelButton" "8"
EndSection

However, sometimes "hold" registers as a click on "back", which is super annoying when I'm browsing a web page. Is there any way I can use the button to scroll but disable single click?

The usual workaround seems to be to use the "forward" button for scrolling, since clicks on that are mostly harmless, but I find having to click that with my ring finger much more awkward than thumbing the back button.

Best Answer

I think the option you're looking for is ButtonMapping. I had a similar annoying feature with my mouse ( https://www.kensington.com/en/no/4493/k72327eu/slimblade-trackball ), so figured this out a while ago.

The "EmulateWheelButton" option still should work even if you disable the button or reassign the mapping...

Now, I've only tested this with xinput on evdev. It's a lot quicker to try things out with xinput and then you could just add a script to your "Startup Applications" instead of having to modify /etc/X11/ and restart X over and over.

So this should be all you need in xorg.d/mouse.conf (the commented out lines are what should be needed if you don't want to use a login script to do this per user), though you might not need this at all if you use xinput:

Section "InputDevice"
    Identifier  "Configured Mouse"
    Driver    "evdev"
    Option    "Device"                "/dev/input/mice"
    Option    "Protocol"              "auto"
    #Option    "EmulateWheel"          "1"
    #Option    "EmulateWheelButton"    "8"
    #Option    "ButtonMapping"        "1 2 3 4 5 6 7 0 9 10 11 12"
EndSection

Here's what I did to figure out my solution (replace my device with your device in the following commands obviously):

Show devices:

$ xinput list
Virtual core pointer                        id=2    [master pointer  (3)]
  ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
  ↳ ELAN Touchscreen                            id=11   [slave  pointer  (2)]
  ↳ SynPS/2 Synaptics TouchPad                  id=13   [slave  pointer  (2)]
  ↳ Kensington Kensington Slimblade Trackball   id=18   [slave  pointer  (2)]

See what properties are supported for that device:

$ xinput list-props "Kensington Kensington Slimblade Trackball"
Device 'Kensington Kensington Slimblade Trackball':
    Device Enabled (142):        1
    Coordinate Transformation Matrix (144):        1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (273):        0
    Device Accel Constant Deceleration (274):        1.000000
    Device Accel Adaptive Deceleration (275):        1.000000
    Device Accel Velocity Scaling (276):        10.000000
    Device Product ID (260):        1149, 8257
    Device Node (261):        "/dev/input/event17"
    Evdev Axis Inversion (277):        0, 0
    Evdev Axes Swap (279):        0
    Axis Labels (280):        "Rel X" (152), "Rel Y" (153), "Rel Vert Wheel" (573)
    Button Labels (281):        "Button Left" (145), "Button Middle" (146), "Button Right" (147), "Button Wheel Up" (148), "Button Wheel Down" (149), "Button Horiz Wheel Left" (150), "Button Horiz Wheel Right" (151), "Button Side" (679), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263)
    Evdev Scrolling Distance (282):        1, 1, 1
    Evdev Middle Button Emulation (283):        0
    Evdev Middle Button Timeout (284):        50
    Evdev Third Button Emulation (285):        0
    Evdev Third Button Emulation Timeout (286):        1000
    Evdev Third Button Emulation Button (287):        3
    Evdev Third Button Emulation Threshold (288):        20
    Evdev Wheel Emulation (289):        1
    Evdev Wheel Emulation Axes (290):        0, 0, 4, 5
    Evdev Wheel Emulation Inertia (291):        10
    Evdev Wheel Emulation Timeout (292):        200
    Evdev Wheel Emulation Button (293):        8
    Evdev Drag Lock Buttons (294):        0

Now let's give it a shot:

$ xinput set-button-map "Kensington Kensington Slimblade Trackball" 1 2 3 4 5 6 7 0 9 10 11 12
$ xinput set-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation" 1
$ xinput set-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation Button" 8

Now my top right button only works as auto-scroll instead of the infuriating back behavior!

Related Question