中古で安かったので衝動買いしたまま家で寝かせてあったDeathAdderを研究室(OSはUbuntu 18.04)にもっていったら、センシを最低値にしてもまだまだ高感度過ぎて使えないという状況に遭遇した。

ゲーミングマウスでも背面のボタン等でDPIを調節することのできるモデルがあるが、DeathAdderにはそういった機能はないので、ビュンビュン過ぎてこまってしまった。

今回それを何とかする。

デバイスIDを調べる

~ $ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Wacom Intuos S 2 Pen stylus               id=9    [slave  pointer  (2)]
⎜   ↳ Wacom Intuos S 2 Pad pad                  id=10   [slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder 2013               id=13   [slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder 2013               id=15   [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)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Topre Corporation RealForce Compact       id=11   [slave  keyboard (3)]
    ↳ Eee PC WMI hotkeys                        id=12   [slave  keyboard (3)]
    ↳ Razer Razer DeathAdder 2013               id=8    [slave  keyboard (3)]
    ↳ Razer Razer DeathAdder 2013               id=14   [slave  keyboard (3)]

なぜか2つずつ見えている。

使えるプロパティを調べる

13の方

~ $ xinput list-props 13
Device 'Razer Razer DeathAdder 2013':
        Device Enabled (154):   1
        Coordinate Transformation Matrix (156): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Natural Scrolling Enabled (291):       0
        libinput Natural Scrolling Enabled Default (292):       0
        libinput Send Events Modes Available (276):     1, 0
        libinput Send Events Mode Enabled (277):        0, 0
        libinput Send Events Mode Enabled Default (278):        0, 0
        Device Node (279):      "/dev/input/event22"
        Device Product ID (280):        5426, 55
        libinput Drag Lock Buttons (307):       <no items>
        libinput Horizontal Scroll Enabled (308):       1

15の方

~ $ xinput list-props 15
Device 'Razer Razer DeathAdder 2013':
        Device Enabled (154):   1
        Coordinate Transformation Matrix (156): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Natural Scrolling Enabled (291):       0
        libinput Natural Scrolling Enabled Default (292):       0
        libinput Scroll Methods Available (293):        0, 0, 1
        libinput Scroll Method Enabled (294):   0, 0, 0
        libinput Scroll Method Enabled Default (295):   0, 0, 0
        libinput Button Scrolling Button (296): 2
        libinput Button Scrolling Button Default (297): 2
        libinput Middle Emulation Enabled (298):        1
        libinput Middle Emulation Enabled Default (299):        0
        libinput Accel Speed (300):     0.000000
        libinput Accel Speed Default (301):     0.000000
        libinput Accel Profiles Available (302):        1, 1
        libinput Accel Profile Enabled (303):   1, 0
        libinput Accel Profile Enabled Default (304):   1, 0
        libinput Left Handed Enabled (305):     0
        libinput Left Handed Enabled Default (306):     0
        libinput Send Events Modes Available (276):     1, 0
        libinput Send Events Mode Enabled (277):        0, 0
        libinput Send Events Mode Enabled Default (278):        0, 0
        Device Node (279):      "/dev/input/event2"
        Device Product ID (280):        5426, 55
        libinput Drag Lock Buttons (307):       <no items>
        libinput Horizontal Scroll Enabled (308):       1

libinput Accel Speedを使う

$ xinput set-prop 13 'libinput Accel Speed' -0.99999

これでちゃんと人間に扱えるセンシになってくれた。

補足1:Device Accel Constant Decelerationを使う方法

ググると上に来るのはこっちの方法だと思う。

$ xinput set-prop 13 "Device Accel Constant Deceleration" 3

とやればいいらしいが、自分の環境では該当するプロパティが存在しないので

property 'Device Accel Constant Deceleration' doesn't exist, you need to specify its type and format

と怒られる。DeathAdderくんは対応してないのかOSのバージョンかわからない。synapticsからlibinputになる過程でこのへんの仕様も変わっているのかもしれない。

補足2:ID調べるの面倒くさい

名前で指定すると、複数デバイスに同一名称が割り振られてみえるせいでうまく行かない。

$ xinput set-prop 'pointer:Razer Razer DeathAdder 2013' "libinput Accel Speed" -0.99999
Warning: There are multiple devices matching 'pointer:Razer Razer DeathAdder 2013'.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with 'pointer:' or 'keyboard:' as appropriate.

unable to find device pointer:Razer Razer DeathAdder 2013

こんな感じになる。なので以下のように無理やりIDを拾うとよい。

$ MOUSE_ID=`xinput list | grep DeathAdder | awk '{print $(NF-3)}' | cut -c4-5 | head -n 1`

DeathAdder部分をあなたのお好みに。そんなこんなをDE起動時に通る部分に書いておけばよいだろう。