How can I simulate the middle mouse button on Linux?

0

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'"
    b:8

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.

Brōtsyorfuzthrāx

Posted 2017-10-10T06:10:25.697

Reputation: 163

1Both 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 – 2017-10-17T14:47:11.320

Answers

0

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

Russo

Posted 2017-10-10T06:10:25.697

Reputation: 111