Remap buttons on secondary device
I've seen a number of discussions that are similar to this issue but I haven't yet been able to get this working.
I recently broke my left pinky finger pretty badly. I got the Fragpedal Quad and am trying to remap the pedals to things like control and alt and tab.
The device behaves like a mouse - by default, the pedals are mapped to scroll wheel up, scroll wheel down, right click and left click. When I run xinput, I get the following:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Good Work Systems, Inc. GWS IDI Device id=9 [slave pointer (2)]
⎜ ↳ PixArt USB Optical Mouse id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Good Work Systems, Inc. GWS IDI Device id=10 [slave keyboard (3)]
↳ Lenovo Lenovo Black Silk USB Keyboard id=12 [slave keyboard (3)]
↳ Lenovo Lenovo Black Silk USB Keyboard id=13 [slave keyboard (3)]
The pedals are the "Good Work Systems" device.
The closest I've gotten to getting this to behave how I want was creating and editing an .xbindkeys configuration as such:
# Copy
"xte 'keydown Control_L' 'key C' 'keyup Control_L'"
b:5
# Cut
"xte 'keydown Control_L' 'key X' 'keyup Control_L"
b:4
# Paste
"xte 'keydown Control_L' 'key V' 'keyup Control_L'"
b:3
# Select All
"xte 'keydown Control_L' 'key A' 'keyup Control_L'"
b:1
But this affects my regular mouse buttons too. How do I specify a per-device keymapping?
Map your device's mouse buttons to unused mouse buttons, then use your xbindkeys to refer to those.
- Use
xinput list
to find your device's id. - Use
xinput set-button-map
to remap your buttons to other mouse buttons. For example, ifxinput list
indicates your device's id is 15, and your device has four buttons, doxinput set-button-map 15 10 11 12 13
. You've now set device 15's mouse clicks to be b:10, b:11, b:12, and b:13. - Update your .xbindkeysrc to remap those buttons to your desired shortcuts.