2019/1/16

xinput -- set each mouse's button mapping

有兩個mouse,一個左手用,一個右手,要怎麼設定呢?
ref: make mouse left handed-and-right-handed

就是使用 xinput 這個程式

debian default 沒有安裝,所以要用 apt-get install
jessie431:~$ xinput
⎡ Virtual core pointer                     id=2 [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer               id=4 [slave  pointer  (2)]
⎜   ↳ Kensington      Kensington Expert Mouse  id=10 [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad               id=13 [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                    id=14 [slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse               id=16 [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)]
    ↳ Video Bus                                id=8 [slave  keyboard (3)]
    ↳ Power Button                             id=9 [slave  keyboard (3)]
    ↳ Integrated Camera                        id=11 [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard             id=12 [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                   id=15 [slave  keyboard (3)]

會列出所有 input device,和 id

然後用 set-button-map 來分別設定 device 的 button mapping (left, right handed)

可以用 get-button-map 看一下現在的設定。

舉例來說,Kensington 是left handed, Logitech 要是 right handed
先看一下..
jessie431:~$ xinput get-button-map 16
3 2 1 4 5 6 7 8 9 10 11 12 
設成 right handed:
jessie431:~$ xinput set-button-map 16 1 2 3 4 5 6 7 8 9 10 11 12
jessie431:~$ xinput get-button-map 16
1 2 3 4 5 6 7 8 9 10 11 12 
這樣 Logitech (id=16) 的 button mapping 就變更了,其他 device 的 mapping 沒變。

沒有留言:

張貼留言