0

I was looking at this which answers if there is only one of the device names. The id's can change when unplugging the device and plugging it back in, this is why I need to get them by their names. I however have two:

enter image description here

SteelSeries Sensei Raw Gaming Mouse

How would I fix this in a script? I need the first one to have specific settings and the second one to have specific settings.

In other words how do I acquire both id's and in the order they appear? Some sort of for loop that checks the output or something.

1 Answers1

0

Someone in SO has provided a nice script that might help you. Change the commands accordingly.

You can do something like the following:

if [ "$SEARCH" = "" ]; then 
    exit 1
fi

ids=$(xinput --list | awk -v search="$SEARCH"
'$0 ~ search {match($0, /id=[0-9]+/);
if (RSTART)
print substr($0, RSTART+3, RLENGTH-3)
}'
)

for i in $ids do xinput set-prop $i 'Device Accel Profile' -1 xinput set-prop $i 'Device Accel Constant Deceleration' 2.5 xinput set-prop $i 'Device Accel Velocity Scaling' 1.0 done

So with this you first find all the IDs which match the search pattern $SEARCH and store them in $ids. Then you loop over the IDs and execute the three xinput commands.

You should make sure that $SEARCH does not match to much, since this could result in undesired behavior.

Ron
  • 20,638