Created
June 27, 2018 19:27
-
-
Save edavis25/608b9630eea7e7b6709104665c013bb9 to your computer and use it in GitHub Desktop.
Shell script for setting mouse sensitivity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
flag=true | |
while [ "$flag" == true ]; do | |
xinput --list | |
echo "##################################################" | |
echo "Select the ID of your input device:" | |
read input_device | |
selected_device=`xinput --list | grep id=$input_device` | |
if [ -z "$selected_device" ]; then | |
echo "Input device with id: \"$input_device\" not found." | |
echo "Would you like to try again? [Y/N]" | |
again_flag=true | |
while [ "$again_flag" == true ]; do | |
read again_input | |
if [ "$again_input" == "Y" ] || [ "$again_input" == "y" ]; then | |
again_flag=false | |
elif [ "$again_input" == "N" ] || [ "$again_input" == "n" ]; then | |
echo "Bye!" | |
exit 1 | |
else | |
echo "I don't understand. Please enter [Y/N]" | |
fi | |
done | |
else | |
echo "Your selected device:" | |
printf "\n" | |
echo $selected_device | |
printf "\n" | |
input_flag=true | |
while [ "$input_flag" == true ]; do | |
echo "Would you like to change sensitivity of this device? [Y/N]" | |
read confirm_input | |
if [ "$confirm_input" == "Y" ] || [ "$confirm_input" == "y" ]; then | |
flag=false | |
input_flag=false | |
break | |
elif [ "$confirm_input" == "N" ] || [ "$confirm_input" == "n" ]; then | |
echo "Select another device? [Y/N]" | |
another_flag=true | |
while [ $another_flag == "true" ]; do | |
read another_select | |
if [ "$another_select" == "Y" ] || [ "$another_select" == "y" ]; then | |
another_flag=false | |
input_flag=false | |
break | |
elif [ "$another_select" == "N" ] || [ "$another_select" == "n" ]; then | |
echo "Bye!" | |
exit 1 | |
else | |
echo "I don't understand. Please enter [Y/N]" | |
fi | |
done | |
fi | |
done | |
fi | |
done | |
current_value=`xinput --list-props 15 | grep "Device Accel Constant Decel" | cut -f3` | |
echo "Choose the deceleration value (current = $current_value). Higher is slower (default = 1)" | |
read decel_value | |
xinput --set-prop $input_device "Device Accel Constant Deceleration" $decel_value | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment