I'm trying to set xinput properties for a USB input device whenever it is connected. I have seen solutions that require a script to run in the background and poll USB devices, but I would like to find a triggered approach rather than one involving user-space polling.

I have tried creating a udev rule that runs a script on device connection, but it appears that the connected device is not yet visible to xinput when the udev add rule is triggered. This appears to be a constant order of events rather than a race condition as adding a sleep command to the script also delays the device being listed in xinput list.

Is there any reliable method of setting xinput properties for devices when they are connected?

  • 1
    why trigger them on udev and not on xinput events? the former requires root, it's tricky, system-dependent, and messes with stuff it has not business messing with. The latter could be done be any x11 client, via the xinput or xinput2 extension. Also have a look here.
    – user313992
    Commented Aug 18, 2019 at 8:28

2 Answers 2


I had the same problem. My solution was to trigger the udev rule with ACTION=="bind" instead of ACTION=="add" (Because I saw with udevadm monitor that it was last action when I connected a mouse)


The normal method is to write an xorg.conf file, use the InputClass matching methods, and set properties directly in xorg.conf. No script, no race condition, no explicit meddling with udev; it just works, though it doesn't use xinput directly...

See man xorg.conf for details.

  • xinput has properties listing, but xorg.conf does not. Is there a way to know the property exact name to be used in xorg.conf?
    – user.dz
    Commented Oct 13, 2019 at 22:57
  • 2
    Ok, never mind, found it man(4) libinput , have nice time.
    – user.dz
    Commented Oct 14, 2019 at 10:35
  • 2
    +1 for the clue, but for exactly how-to you must look here: unix.stackexchange.com/questions/58117/…
    – WesternGun
    Commented Apr 14, 2021 at 8:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .