I just got a 4-button trackball mouse without a mousewheel (many of those don't have a mousewheel, for some reason), and I would like to make one of those buttons act like the middle mouse button (for the purpose of autoscrolling). The 4-buttons, by default, are for left click, right click, back and forward (i.e. back/forward a page while web browsing). I changed the back/forward buttons to act like page-up and page-down (using xte and xbindkeys as suggested in an answer to a question somewhere on StackExchange), but I wasn't completely satisfied with that; so, I'd like to turn one of those buttons (the back button) into the middle mouse button, and do something creative with the other one, but I don't know how to make one mouse button simulate another (nor do I know the name of the middle mouse button). I do, however, know how to make a mouse button represent a key or key combination on a keyboard (or how to make it launch a program or script). Edit: I found out a way to remap mouse buttons, but it doesn't seem to work with Button-2 (that's the right button, right? I'm wanting the button that makes a circle with arrows appear and when you move the mouse it scrolls in the direction you move it; also, when you click a link with it, it opens it in a new tab, and such).

Anyway, here's what I attempted putting in my .xbindkeysrc file:

"xte 'mouseclick 2'"

Note: Pressing left-click and right-click at the same time doesn't simulate the middle mouse button on my OS (Xubuntu 17.04) with my mouse.

  • 1
    Both xbindkeys and xte are additional applications that intercept X events. It's cleaner to just change the button map, e.g. with xinput --set-button-map or via properties, depending on how your trackball works. See man xinput, and man evdev if you want to record the buttonmap in an xorg.conf to make it work automatically on boot.
    – dirkt
    Oct 17, 2017 at 14:47

1 Answer 1


This can be solved by mapping mouse buttons to keyboard keys via xkbset: see Use keys for mouse buttons on linux. Alternative to AHK?

You must log in to answer this question.

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