使xinput –set-button-map永久更改

我有一个在蓝牙上运行的新鼠标,但我必须使用xinput --set-button-map手动设置鼠标中键。 重启后这不是持久的,所以我写了一个小的python脚本,在登录后自动运行它。 不幸的是,它不起作用,因为在登录后鼠标自动重新连接之前有一些延迟。

我想到只是在我的脚本中添加一些等待,但我确信必须有更好的方法来做到这一点。 我可以挂钩来自/usr/sbin/bluetoothd或类似的连接事件吗?

我花了一些等待时间并重试我的脚本并与之共存了几天,但本周末我有一些空余时间来找到“正确”的解决方案。

也就是说,将按钮映射添加到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 

希望有一天能帮助别人。

我有一个罗技超薄触摸,我得到了重新映射:

/etc/X11/xorg.conf.d/10-evdev.conf ## custom for logitech ultrathin mouse

 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 

不确定是否所有这些都是必需的,但经过一天的摔跤之后,我感到松了一口气……我现在发现水平滚动比我想要慢一点。 所以我可能会看到是否有一些选项来配置它。