Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mouse wheel direction toggle script for Linux
device_name="Logitech M705"
prop_name="Natural Scrolling Enabled"
device_number=$( xinput | grep "${device_name}" | awk -F '\t' '{ print $2 }' | awk -F '=' '{ print $2 }' | tr -d '[:blank:]' )
echo "device number is $device_number"
prop_number=$( xinput list-props $device_number | grep "${prop_name}" | head -n 1 | sed 's/.*(\(.*\)).*/\1/' )
echo "prop number is $prop_number"
prop_value=$( xinput list-props $device_number | grep "${prop_name}" | head -n 1 | sed 's/.*:\(.*\)/\1/' | tr -d '[:blank:]' )
echo "prop value is $prop_value"
if [ $prop_value = "0" ]; then
message="자연스러운 휠 방향으로 설정되었습니다."
message="자연스러운 휠 방향이 해제되었습니다."
xinput set-prop $device_number $prop_number $new_value
zenity --info --title="Change Property" --text="$message" --width=400 --height=200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.