I have a udev rule

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c084", RUN+="/some/script.sh"

which successfully triggers a script like


ls /tmp >> /tmp/lsasd # this line works
touch /tmp/asdasd # this line works

for id in $(xinput --list | \
            sed -n '/Logitech G203 Prodigy Gaming Mouse.*pointer/s/.*=\([0-9]\+\).*/\1/p')
  echo $id >> /tmp/test.log 2>&1
  xinput --set-prop $id 'libinput Accel Profile Enabled' 0, 1

The first two commands work fine but setting the property does not work. The idea is to run the command

xinput --set-prop $id 'libinput Accel Profile Enabled' 0, 1

for all devices found, because I don't know the $id at that point.

Any idea what could be the problem? Are xinput devices not available at that point yet? I tried to add a sleep 5 to test this but this also does not work.

1 Answer 1


I found the answer:

The xinput settings only work in an X context. But they are not run e.g. from a terminal started in your desktop manager.


ACTION=="add", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c084", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/administrator/.Xauthority", RUN+="/some/script.sh"

You can read more about it here, here and here.

You must log in to answer this question.

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