scripted-mouse-acceleration 688 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # disable mouse acceleration with the device name given as an argument
  3. [ -z "$1" ] && exit 1
  4. sleep 5
  5. IDlist=$(xinput | grep -B1000 "Virtual core keyboard" | preconv | cut -d' ' -f5- |\
  6. sed '$ d; /^$/d;' | grep -v "master pointer" | rev | cut -d' ' -f5- | rev |\
  7. sed 's/\[slave//g;' | tr '\t' ' ' )
  8. chosenDevice="$1"
  9. chosenID=$(echo "$IDlist" | grep "$chosenDevice" | awk '{print $NF}' | sed 's/id=//g')
  10. [ -z "$chosenID" ] && exit 1
  11. # disable the mouse acceleration (using xorg-xinput)
  12. xinput --set-prop "$chosenID" 'libinput Accel Speed' 0
  13. xinput --set-prop "$chosenID" 'libinput Accel Profile Enabled' 0, 1
  14. # set the mouse speed (using xorg-xset)
  15. xset mouse 1 0 &