One of the cool things about trackballs is that the ball can be used for 2D scrolling upon pressing a user-defined button. I have an Elecom Huge trackball and want to configure it with xinput (so that I don't need to reload Xorg). I would like to use the Forward button and remap it so that when it's pressed the ball can be used for scrolling. I'd also like for the button to serve as middle button if no scrolling occurs.

  • a trackball is just a mouse input device ... you can do 2D scrolling with any mouse
    – jsotola
    Commented Dec 16, 2020 at 0:01
  • @jsotola Sure you can, but it's way more comfortable with a trackball. Also, this question was not meant to set trackballs widely apart from mice, rather provide context for a setup I wanted to share with others. Commented Dec 16, 2020 at 9:02

2 Answers 2


Using xinput list one can easily identify the Elecom device by name. In this case the name string is ELECOM TrackBall Mouse HUGE TrackBall. Because Elecom devices report both as pointers and keyboards, an additional prefix of pointer: is required.

Next, one needs to identify the button ID of the button in question. Using xev it is easy to see that the Forward button (the one adjacent to Fn1 and Fn2) has ID 9. What remains to be done is enabling the scrolling method and selecting the scrolling button. The following two lines accomplish that:

xinput set-prop "pointer:ELECOM TrackBall Mouse HUGE TrackBall" 'libinput Button Scrolling Button' 9
xinput set-prop "pointer:ELECOM TrackBall Mouse HUGE TrackBall" 'libinput Scroll Method Enabled' 0 0 1

At this point we have scrolling configured as desired, but the button does not yet serve as middle button. To modify this behavior we remap the buttons so that button 9 reports as 2 (middle):

xinput set-button-map $(xinput list --id-only "pointer:ELECOM TrackBall Mouse HUGE TrackBall") \
1 2 3 4 5 6 7 8 2 10 11 12

In order to make these settings permanent the above lines can be placed e.g. in ~/.xinitrc to be run at the beginning of an Xorg session.


@wojciech-gac's answer is the correct one for this question.

For completion's sake, I'd like to share the equivalent config for people who seek the same feature but would rather have it configured in the Xorg server.

Create a .conf file in one of Xorg config paths. For example:


And put these contents inside:

Section "InputClass"
    Identifier   "Elecom HUGE scroll config"
    MatchDriver  "libinput"
    MatchVendor  "ELECOM"
    MatchProduct "HUGE TrackBall"
    Option       "ScrollMethod" "button"
    Option       "ScrollButton" "9"
    Option       "ButtonMapping" "1 2 3 4 5 6 7 8 2 10 11 12"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .