xinput

systemLinux/Unix
The xinput command is one of the most frequently used commands in Linux/Unix-like operating systems. xinput A utility to configure and test X input devices

Quick Reference

Command Name:

xinput

Category:

system

Platform:

Linux/Unix

Basic Usage:

xinput [options] [arguments]

Common Use Cases

    Syntax

    xinput [options] [command] [device]

    Options

    Command Description
    version Show the version of the program
    list [--short | --name-only | --id-only] List available devices with their information
    get-feedbacks device List device feedback states
    set-pointer device Change a device to a pointer device
    set-integer-feedback device feedback value Set feedback's value
    set-button-map device map_button_1 [...] Set button mapping for a device
    get-button-map device Get button mapping for a device
    set-pointer-buttons device num_buttons Set number of buttons for a pointer device
    set-mode device ABSOLUTE|RELATIVE Set device mode
    query-state device Query device state
    test device Enter test mode to see device events
    test-xi2 [--root] device Enter XI2 test mode to see device events
    list-props device [--short || --type] List device properties
    set-prop device property value Set device property value
    watch-props device Watch device property changes
    delete-prop device property Delete device property
    set-float-prop device property val [val ...] Set a float property for a device
    set-int-prop device property format val [val ...] Set an integer property for a device
    set-atom-prop device property val [val ...] Set an atom property for a device
    disable device Disable a device
    enable device Enable a device
    map-to-output device output Map device to the specified output
    list-hierarchy [--short] List device hierarchy
    reattach device master Reattach device to specified master device
    float device Remove device from master device
    create-master name Create a pair of master devices
    remove-master id [Floating|AttachToMaster masterId] Remove a master device

    Global Options

    Option Description
    --display display X display to use
    --help Show usage
    -v, --version Show version

    Examples

    How to Use These Examples

    The examples below show common ways to use the xinput command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    # List all input devices xinput list
    # Get device information xinput list-props "Logitech USB Optical Mouse"
    # Disable a device xinput disable 12
    # Enable a device xinput enable 12
    # Advanced Examples Advanced
    # Change a device property xinput set-prop "Synaptics TouchPad" "libinput Tapping Enabled" 1 # Set mouse speed/acceleration xinput set-prop "Logitech USB Optical Mouse" "libinput Accel Speed" 0.5 # Test a device (showing events) xinput test 12 # Map a device to a specific screen area xinput map-to-output "Wacom Pen" HDMI-1 # Reattach a device to its parent xinput reattach 13 3 # Create a pair of master devices xinput create-master "new-keyboard-mouse"

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The `xinput` command is a versatile utility for configuring and troubleshooting input devices in the X Window System environment. It provides a command-line interface to query and modify the properties and behavior of keyboards, mice, touchpads, tablets, and other input devices. **Key Features:** 1. **Device Management**: - List all input devices connected to the system - Enable or disable specific devices - View and modify device properties - Change button mappings and pointer behavior 2. **Testing and Diagnostics**: - Test input devices to see their event output - Query device state for troubleshooting - Monitor property changes in real-time 3. **Advanced Configuration**: - Map input devices to specific outputs (screens) - Create virtual master devices - Configure device hierarchies - Adjust touchpad sensitivity, acceleration, and other parameters **Common Use Cases:** 1. **Touchpad Configuration**: One of the most common uses for xinput is configuring touchpad behavior, such as enabling/disabling tapping, natural scrolling, or adjusting sensitivity: ```bash # Enable tapping on a Synaptics touchpad xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1 # Enable natural scrolling xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Natural Scrolling Enabled" 1 ``` 2. **Mouse Acceleration**: Adjusting mouse acceleration and speed: ```bash # Set acceleration speed (range typically -1 to 1) xinput set-prop "Logitech USB Optical Mouse" "libinput Accel Speed" 0.5 # Disable acceleration completely xinput set-prop "Logitech USB Optical Mouse" "libinput Accel Profile Enabled" 0, 1 ``` 3. **Tablet Configuration**: For graphics tablets, xinput can map the device to a specific monitor in multi-monitor setups: ```bash # Map a Wacom tablet to the primary monitor xinput map-to-output "Wacom Intuos Pro M Pen" "HDMI-1" ``` 4. **Troubleshooting**: When an input device isn't working correctly, xinput can be used to test it: ```bash # See all events from a device xinput test 12 ``` 5. **Button Remapping**: Changing what different mouse buttons do: ```bash # Swap left and right mouse buttons xinput set-button-map "USB Optical Mouse" 3 2 1 ``` **Device Identification:** When using xinput commands, devices can be referred to in three ways: 1. By name (in quotes): `"SynPS/2 Synaptics TouchPad"` 2. By ID (numeric): `12` 3. By a partial but unique name (in quotes): `"Synaptics"` **Device Properties:** The properties available for each device depend on its type and the drivers in use. Common property types include: 1. **libinput Properties** (for devices using the libinput driver): - `libinput Accel Speed` - `libinput Natural Scrolling Enabled` - `libinput Tapping Enabled` - `libinput Disable While Typing Enabled` 2. **Synaptics Properties** (for touchpads using the synaptics driver): - `Synaptics Finger` - `Synaptics Scrolling Distance` - `Synaptics Edge Scrolling` 3. **Evdev Properties** (for devices using the evdev driver): - `Evdev Axis Inversion` - `Evdev Wheel Emulation` **Making Changes Persistent:** Changes made with xinput are temporary and will reset after a system reboot or X server restart. To make them permanent, you can: 1. Add xinput commands to your X startup scripts (e.g., `~/.xinitrc` or `~/.xprofile`) 2. Create X configuration files in `/etc/X11/xorg.conf.d/` 3. Use desktop environment-specific tools (e.g., GNOME's gsettings) **Integration with X Input Extension:** xinput works with the X Input Extension (XInput), which provides additional functionality beyond the core X protocol for handling input devices. The XInput2 version adds support for multitouch and other advanced features. **Limitations:** 1. xinput only works with X Window System, not Wayland 2. Changes are not persistent across reboots without additional configuration 3. Some properties might be specific to certain drivers or hardware 4. The command line syntax can be complex for advanced operations **Alternatives and Complementary Tools:** 1. **xset**: For basic mouse acceleration and keyboard settings 2. **synclient**: Specifically for Synaptics touchpads 3. **xbindkeys**: For binding commands to specific input events 4. **libinput-gestures**: For configuring multitouch gestures 5. **Wayland-specific tools**: For systems using Wayland instead of X xinput is an essential tool for X Window System users who need fine-grained control over their input devices, especially in situations where the graphical configuration tools provided by desktop environments are insufficient.

    Related Commands

    These commands are frequently used alongside xinput or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the xinput command works in different scenarios.

    $ xinput
    View All Commands