Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

How do you remap mouse buttons?

+3
−0

How can I remap buttons on my mouse, especially for more exotic ones like MMO mice?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

3 answers

You are accessing this answer with a direct link, so it's being shown above all other answers regardless of its score. You can return to the normal view.

+1
−0

Piper can be used for this. All mice supported by Piper (actually libratbag) are a result of the community reverse engineering the mouse protocol. It will not support all mice, but only selected ones.

Corsair mice are not supported by Piper, but they are supported by ckb-next which is analogous to Piper, but for Corsair only.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Looking for more (1 comment)
+2
−0

Wayland, ideally

If you are on Wayland, the blessed way is to use the configuration for your desktop environment (DE) to map mouse keys and other input devices, except for a couple well-known options (eg left-handed mode and middle mouse emulation).

Wayland, via hwdb

If your DE doesn't have configuration for mouse key bindings, you may be able to mess with the hwdb like this person on Reddit. Wayland's current version of libinput says not to do this anymore, but if you're stuck you're stuck.

Get the device ID

$ lsusb | grep Kens
Bus 001 Device 008: ID 047d:8018 Kensington

Get the input events with evtest

Event: time 1584228876.372060, -------------- SYN_REPORT ------------
Event: time 1584228877.572302, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1584228877.572302, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
Event: time 1584228877.572302, -------------- SYN_REPORT ------------

I was lucky because I really just wanted to swap two buttons, and evtest dumped the supported events when you select your device. You may be able to figure out the key codes to emulate. I did get hung up on evtest reporting BTN_SIDE, but having to use lower-case btn_side in the hwdb entry.

Add changes to the hwdb

I'm on Fedora 31, and have been using [a] hwdb entry for a while, because I didn't like the default button configuration on my trackball -- they're frankly backwards for a right-handed person, and the Windows software recognized the need to swap them. (note: Indents are important iirc)

[The] rule in my hwdb entry (evdev:input:b*v047Dp8018*) is just the USB Vendor + Product

$ cat 90-trackball-buttons.hwdb 
# Kensington Expert Mouse Trackball:
# * Rebind top-left from BTN_MIDDLE to BTN_SIDE
# * Rebind top-right from BTN_SIDE to BTN_MIDDLE
evdev:input:b*v047Dp8018*
 KEYBOARD_KEY_90003=btn_side
 KEYBOARD_KEY_90004=btn_middle

Reload your hwdb

$ sudo systemd-hwdb update
$ sudo udevadm trigger /sys/class/input/eventX
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

+1
−0

No wonder it's hard to find good programs - it's no longer necessary! At some point this became a built in part of Xorg via xinput.

The process is something like this:

  • xinput list and find the ID of your mouse
  • xinput get-button-map $MOUSE_ID and see the current map
  • xev -event button | grep button to check which button is which
  • xinput set-button-map $MOUSE_ID $NEW_BUTTON_MAP to remap

This will only work until the next reboot.

To make it permanent you can create Xorg config files (described in the link).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »