#!/bin/bash
# Name that unmistakably identifies mouse. Use `xinput --list` to query.
DEVICE_STRING="A4TECH"
# Default xinput settings; somehow necessary to avoid glitchy behaviour.
xset mouse
# Query device ID
DEVICE_ID=$(xinput --list | grep -Po "${DEVICE_STRING}.+id=\K(\d{1,2})")
# Set profile to "polynomial", arguably the best default. Accelerates any motion (no threshold).
xinput set-prop ${DEVICE_ID} "Device Accel Profile" 2
# Supposedly 1000/DevicePollingRateHz, which would be 1000/1000Hz = 1ms, if my understanding is
# correct (this needs to be set in the kernel!)
xinput set-prop ${DEVICE_ID} "Device Accel Velocity Scaling" 1
# Mouse "speed" effectively
xinput set-prop ${DEVICE_ID} "Device Accel Constant Deceleration" 2.3