如何在连接设备事件后永久设置“xinput set-prop”

如何在连接设备事件后永久设置“xinput set-prop”

将 Apple Magic Mouse 2 连接到笔记本电脑后,我遇到了鼠标滚动问题(即滚动不起作用)。因此,我找到了一行解决方法:xinput set-prop 14 300 0 0 1,来自:

$ xinput list                                                                                                                             idanko@mbp
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ bcm5974                                   id=13   [slave  pointer  (2)]
⎜   ↳ Illia Danko’s Mouse                       id=14   [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)]
    ↳ Sleep Button                              id=10   [slave  keyboard (3)]
    ↳ FaceTime HD Camera (Built-in):            id=11   [slave  keyboard (3)]
    ↳ Apple Inc. Apple Internal Keyboard / Trackpad id=12   [slave  keyboard (3)

$ xinput list-props 14                                                                                                                    idanko@mbp
Device 'Illia Danko’s Mouse':
    Device Enabled (149):   1
    Coordinate Transformation Matrix (151): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (295):   0
    libinput Natural Scrolling Enabled Default (296):   0
    libinput Scroll Methods Available (299):    0, 0, 1
    libinput Scroll Method Enabled (300):   0, 0, 0
    libinput Scroll Method Enabled Default (301):   0, 0, 0
    libinput Button Scrolling Button (628): 3
    libinput Button Scrolling Button Default (629): 3
    libinput Accel Speed (307): -0.525180
    libinput Accel Speed Default (308): 0.000000
    libinput Accel Profiles Available (630):    1, 1
    libinput Accel Profile Enabled (631):   1, 0
    libinput Accel Profile Enabled Default (632):   1, 0
    libinput Left Handed Enabled (309): 0
    libinput Left Handed Enabled Default (310): 0
    libinput Send Events Modes Available (272): 1, 0
    libinput Send Events Mode Enabled (273):    0, 0
    libinput Send Events Mode Enabled Default (274):    0, 0
    Device Node (275):  "/dev/input/event11"
    Device Product ID (276):    76, 617
    libinput Drag Lock Buttons (311):   <no items>
    libinput Horizontal Scroll Enabled (312):   1

但它只能手动工作,并且在设备重新连接时始终重置。所以我尝试添加/usr/share/X11/xorg.conf.d/50-magicmouse.conf以下内容:

Section "InputClass"
  Identifier "Apple Magic Mouse" # This can be anything
  MatchIsPointer "on"
  MatchDevicePath "/dev/input/event*"
  MatchProduct "Illia Danko’s Mouse" # Product name from 'xinput list'
  Driver "libinput" # From '.local/share/xorg/Xorg.0.log' after mouse connected
  Option "Scroll Method" "edge"
EndSection

但它不起作用,请指出可能存在的问题

相关内容