4

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?

sixtimes
  • 181
  • 4

2 Answers2

3

Map your device's mouse buttons to unused mouse buttons, then use your xbindkeys to refer to those.

  1. Use xinput list to find your device's id.
  2. Use xinput set-button-map to remap your buttons to other mouse buttons. For example, if xinput list indicates your device's id is 15, and your device has four buttons, do xinput 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.
  3. Update your .xbindkeysrc to remap those buttons to your desired shortcuts.
0

I realize this is 2 years old at this point, and already answered, but for future reference, you can specify the device ID in your call to xte.

# Copy
"xte -i 9 'keydown Control_L' 'key C' 'keyup Control_L'"
  b:5

# Cut
"xte -i 9 'keydown Control_L' 'key X' 'keyup Control_L"
  b:4

# Paste
"xte -i 9 'keydown Control_L' 'key V' 'keyup Control_L'"
  b:3

# Select All
"xte -i 9 'keydown Control_L' 'key A' 'keyup Control_L'"
  b:1

This should limit the change to the single device identified by the ID given as -i. Since these IDs can be mapped differently at each startup, you may want to scriptify the change so you can execute it manually.

(see also https://askubuntu.com/a/492745)