Created
August 6, 2018 17:02
-
-
Save rlaace423/567851355a8f90e525b1eaa402f7c27b to your computer and use it in GitHub Desktop.
mouse wheel direction toggle script for Linux
This file contains 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 | |
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 | |
new_value=1 | |
message="자연스러운 휠 방향으로 설정되었습니다." | |
else | |
new_value=0 | |
message="자연스러운 휠 방향이 해제되었습니다." | |
fi | |
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