spacepaste

  1.  
  2. #!/usr/bin/env bash
  3. id=8
  4. propSens=154
  5. propAccel=280
  6. screenWidth=1920
  7. screenHeight=1080
  8. if [ "$1" == "-h" ]; then
  9. echo "HOW TO SET UP SCRIPT:"
  10. echo "Before the script will work you need to provide it with some information."
  11. echo "Maybe one day I'll work on automating it, but for now you have to do it manually:"
  12. echo ""
  13. echo "1) In a terminal run \"xinput\""
  14. echo " Look for your mouse \"id\". If you aren't sure which one it is,"
  15. echo " or if you see duplicates then just pick one. If it doesn't work"
  16. echo " at the end then return to this step and try a different value."
  17. echo ""
  18. echo "2) Take the \"id\" value from above and use it with the command:"
  19. echo " xinput list-props ID"
  20. echo ""
  21. echo "3) Look for the value \"Coordinate Transformation Matrix\","
  22. echo " and directly to the right of it is a number in parenthesis."
  23. echo " This number will be called \"propSens\""
  24. echo ""
  25. echo "4) Look for the value \"Device Accel Profile\","
  26. echo " The number in parenthesis will be called \"PropAccel\""
  27. echo ""
  28. echo "5) Open this script up in a text editor and change the values for"
  29. echo " id, propSens, and propAccel that you found above."
  30. echo " Also adjust the screenWidth and screenHeight variables to your resolution"
  31. echo ""
  32. echo "6) Run the script and tell it to use any sensitivity you want. For example:"
  33. echo " ./this_script SENSITIVITY"
  34. echo " If it doesn't work then go back to step #1 and try a different id."
  35. fi
  36. sens=$1
  37. xoffset=`python -c "print(${screenWidth}*0.5-${screenWidth}*0.5*${sens}+1)"`
  38. yoffset=`python -c "print(${screenHeight}*0.5-${screenHeight}*0.5*${sens}+1)"`
  39. xset m 0 0; xinput set-prop ${id} ${propAccel} -1; xinput set-prop ${id} ${propSens} ${sens}, 0, ${xoffset}, 0, ${sens}, ${yoffset}, 0, 0, 1
  40.