Skip to content

Commit 0fc4b6b

Browse files
committed
update mousescroll
1 parent 8523a79 commit 0fc4b6b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mouse_scroll

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

8686
# SCRIPT
87-
xinput list|grep Mouse|while read device;do
88-
log "Device=$device"
89-
eval $(echo $device|grep -Eo 'id=[0-9]{2}')
87+
xinput list|awk -F 'id=' '/MX Anywhere|Mouse/ {print $2}'|awk '{print $1}'|while read id;do
9088
device_name="$(xinput list --name-only $id)"
89+
log "Device=$device_name"
9190
natural_scroll_option_status=$(xinput --list-props $id|awk '/Natural Scrolling Enabled \(/ {print $6}')
9291
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 ("
92+
xinput set-int-prop $id "libinput Natural Scrolling Enabled" 8 1
93+
xinput list-props $id |grep "Natural Scrolling Enabled ("
9594

9695
# When "Logitech USB Laser Mouse" is present:
9796
if [[ "$device_name" == "Logitech USB Laser Mouse" ]];then
9897
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"
98+
xinput set-prop $id "Coordinate Transformation Matrix" 2 0 0 0 2 0 0 0 1
99+
xinput list-props $id |grep "Coordinate Transformation Matrix"
101100
fi
101+
echo
102102
done
103103

104104

0 commit comments

Comments
 (0)