Skip to content

Commit 287d5c5

Browse files
committed
Fix mouse scroll
1 parent e37eaa3 commit 287d5c5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

mouse_scroll

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,21 @@ log () { printf '%s %s\n' "$(date +%F' '%T)" "$@"; }
8585

8686
# SCRIPT
8787
xinput list|grep Mouse|while read device;do
88+
log "Device=$device"
8889
eval $(echo $device|grep -Eo 'id=[0-9]{2}')
89-
natural_scroll_option_code=$(xinput --list-props $id|awk '/Natural Scrolling Enabled \(/ {sub (/\(/, "");sub (/\)/, "");sub (/\:/, "");print $5}')
90-
xinput set-int-prop $id $natural_scroll_option_code 8 1
90+
device_name="$(xinput list --name-only $id)"
91+
natural_scroll_option_status=$(xinput --list-props $id|awk '/Natural Scrolling Enabled \(/ {print $6}')
92+
log "ID=$id, name=$device_name and Natural scrolling status=$natural_scroll_option_status"
93+
xinput set-int-prop "$device_name" "libinput Natural Scrolling Enabled" 8 1
94+
xinput list-props "$device_name" |grep "Natural Scrolling Enabled ("
95+
96+
# When "Logitech USB Laser Mouse" is present:
97+
if [[ "$device_name" == "Logitech USB Laser Mouse" ]];then
98+
log "Increase speed of $device_name."
99+
xinput set-prop "$device_name" "Coordinate Transformation Matrix" 2 0 0 0 2 0 0 0 1
100+
xinput list-props "$device_name"|grep "Coordinate Transformation Matrix"
101+
fi
91102
done
92103

104+
93105
# END

0 commit comments

Comments
 (0)