xinput
是 Linux 系统中的一个命令行工具,用于配置和调试输入设备(如鼠标、键盘、触摸板、触摸屏等)。它基于 X Input Extension(XIE)协议,允许用户查询、修改和管理与 X 服务器交互的输入设备。
列出输入设备
xinput list
查看设备属性
xinput list-props <设备ID或名称>
修改设备属性
xinput set-prop <设备ID或名称> <属性ID> <值>
启用/禁用设备
xinput disable <设备ID或名称>
xinput enable <设备ID或名称>
重新映射设备
bash
xinput set-button-map <设备ID> 1 2 3 ...
禁用笔记本触摸板
xinput disable "SynPS/2 Synaptics TouchPad"
调整鼠标指针速度
xinput set-prop "Logitech USB Mouse" "libinput Accel Speed" 0.5
强制使用左手鼠标(交换左右键)
xinput set-button-map <鼠标ID> 3 2 1
校准触摸屏
xinput set-prop "ELAN Touchscreen" "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
xinput
仅适用于 X Window 环境(不适用于 Wayland)。sudo
或加入 input
用户组才能修改设备属性。xinput
的修改是临时的,重启后失效。若需持久化,可将命令添加到 ~/.xinitrc
或桌面环境的启动脚本中。libinput
相关工具(如 libinput debug-events
)。xmodmap
(键盘映射)、xset
(指针和屏幕设置)。如果需要进一步帮助(如查找设备的具体名称或属性),可以结合 xinput list
和 grep
进行筛选,例如:
xinput list | grep -i touch