Slow down your gaming mouse in Linux!

Last week I updated/added Ubuntu 10.10 to my gaming machine. But when trying to play some games via wine, I realized that my Sharkoon Fireglider was still too fast, even at the lowest settings. The Ubuntu mouse settings did not allow me to push the slider further down.

After some research I decided to write a little script that would allow me to do this manually. It sets the sensitivity and the acceleration to a desired number and outputs the current settings.

Here it is:


#!/bin/sh
#
# bash script to slow down gaming mice even below the
# lowest values supported in XServer mouse config dialogs
#
# author: Uwe Jugel
# contact: http://open-juve.blogspot.com/
# license: creative commons, http://http://creativecommons.org/licenses/by/3.0/
#
# usage: ./slow-mouse [sensitivity] [acceleration]
#
# useful values for my Sharkoon Fireglider: 5,1


device_str="A4Tech"

id=`xinput --list --short | grep -m1 $device_str | sed 's/.*id=//' | sed 's/\s*\[.*\].*//'`

echo "---------------------"
echo "old settings:"
xinput --list-props $id | grep -E Decel\|Scali
echo "---------------------"

sens=$1
accel=$2
echo "setting sens/accel to $sens/$accel"

`xinput --set-prop $id "Device Accel Constant Deceleration" $sens`
`xinput --set-prop $id "Device Accel Velocity Scaling" $accel`

echo "---------------------"
echo "new settings:"
xinput --list-props $id | grep -E Decel\|Scali
echo "---------------------"

Comments