2021/12/13 - Remap Mouse Buttons to Keyboard Keys

Filed under: Software — trinque @ 8:43 p.m.

I've written a little Python script to help alleviate RSI when using a laptop keyboard. allows you to remap mouse buttons to arbitrary keyboard key-presses, and supports alternate keys for double-taps. I made this with the ThinkPad layout in mind, but it might be useful for other machines. This will work in both Linux virtual terminals and graphical sessions.

In my own setup, the middle-click serves as a super key, and when double-tapped sends escape. I've mapped right-click to a control key. None of my preferences are hard-coded into the script. Note also that it won't prevent the original function of the mouse buttons. This is intentional, so that I can use them for both modifier key and mousing functions.

Find it here.