Created
October 15, 2017 20:37
-
-
Save shimataro/b9093e982c65f442eee6649e9047265e to your computer and use it in GitHub Desktop.
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 | |
# reverse mouse scroll direction | |
function _reverse_mouse_scroll_direction() { | |
local IFS=$'\n' | |
local DEVICE_NAME=$1 | |
local PROP_NAME=$2 | |
for id in $(xinput list | grep -F "${DEVICE_NAME}" | perl -n -e'/id=(\d+)/ && print $1') | |
do | |
for prop in $(xinput list-props "$id" | grep -F "${PROP_NAME}" | perl -n -e'/:\s*(-?\d+)\s*,\s*(-?\d+)\s*$/ && print -$1, " ", -$2') | |
do | |
eval "xinput set-prop ${id} \"${PROP_NAME}\" $prop" | |
done | |
done | |
} | |
_reverse_mouse_scroll_direction "Synaptics TouchPad" "Synaptics Scrolling Distance" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment