使 xinput --set-button-map 更改永久生效

使 xinput --set-button-map 更改永久生效

我有一个使用蓝牙的新鼠标,但我不得不使用 手动设置鼠标中键xinput --set-button-map。重启后,此功能不会持续,因此我编写了一个小型 Python 脚本,以便在登录后自动运行它。不幸的是,它不起作用,因为在登录后鼠标自动重新连接之前有一些延迟。

我曾想过在脚本中添加一些等待,但我确信一定有更好的方法。我可以/usr/sbin/bluetoothd改为挂接连接事件或类似的东西吗?

答案1

我在脚本中加入了一些等待时间和重试,并且坚持了几天,但这个周末我有一些空闲时间来寻找“正确”的解决方案。

也就是说,将按钮映射添加到 X 的配置文件中。

#/usr/share/X11/xorg.conf.d/logitech-mx-revolution.conf

Section "InputClass"
    Identifier  "Logitech MX Revolution Mouse"
    Option  "ButtonMapping" "1 2 3 4 5 6 7 9 8 10 11 12 13 14 15 2 17 18 19 20 21 22 23 24"
EndSection

希望有一天这能帮助到别人。

答案2

我有一台 Logitech Ultrathin Touch,并且我已将其重新映射以便使用:

/etc/X11/xorg.conf.d/10-evdev.conf # # 为罗技超薄鼠标定制

Section "InputDevice"
    Identifier "Logitech bluetooth Touch Mouse"
    Driver "evdev"
    Option "Name"   "Ultrathin Touch Mouse"
    Option "ButtonMapping" "1 1 3 4 5 6 7 0 0 0 0 0 0"
EndSection


Section "InputClass"
    Identifier  "Ultrathin Touch Mouse"
    Option "ButtonMapping" "1 1 3 4 5 6 7 0 0 0 0 0 0"
EndSection

不确定是否需要所有这些,但是经过一天的努力之后,我只是松了一口气,有些东西可以工作......我现在发现水平滚动比我想要的要慢一些。所以我可能会看看是否有一些选项可以配置它。

相关内容