Xinput Command
The xinput command is a powerful utility for configuring and testing input devices within the X Window System on Linux. It allows users to view, modify, and manage various aspects of their keyboards, mice, touchscreens, and other input peripherals.
List Input Devices
To see a comprehensive list of all input devices that the X server currently recognizes, use the list command:
# xinput list
View Device Properties
Each input device has a set of properties that can be inspected and modified. To view the properties of a specific device, you first need its ID. For example, to list properties for device ID 8:
# xinput --list-props 8
This output will show details like the device name, its capabilities, and configurable parameters. One common property is 'Coordinate Transformation Matrix' (CTM).
Modify Coordinate Transformation Matrix (CTM)
The 'Coordinate Transformation Matrix' property (often property ID 157) allows for fine-grained control over how input coordinates are transformed. This can be used for scaling, rotation, or other adjustments. The command structure is:
# xinput --set-prop [device ID] [property ID] [values...]
For example, to set the CTM for device 8:
# xinput --set-prop 8 157 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000
The values typically correspond to X sensitivity, Y rotation, an unused value, X rotation, Y sensitivity, and other transformation parameters. The exact order and meaning of these values can vary.
Disable Input Devices
If you need to temporarily disable an input device, such as a touchscreen that is interfering with mouse input, you can use the disable command:
# xinput disable [touchscreen XID]
Replace [touchscreen XID] with the actual ID of the device you wish to disable.
Remap Mouse Buttons
You can also remap mouse buttons using the set-button-map command. This is useful for disabling specific buttons or reassigning their functions. The numbers represent the actions for the left, middle, and right buttons, respectively.
# xinput set-button-map [mouse ID] 1 0 3
In this example, 1 0 3 means the left button performs action 1 (left click), the middle button performs no action (0), and the right button performs action 3 (right click). This effectively disables the middle mouse button click.