Created
December 28, 2019 21:33
-
-
Save Djuuu/0a576ec006ba23c24c9576d6a36baaed to your computer and use it in GitHub Desktop.
Logitech MX Master 3 - horizontal scroll as buttons - sensitivity reduction on Linux (xbindkeys & external script)
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
## Scrollwheel left | |
"~/.xbindkeys/MX-Master-3-bindings.sh Scroll_L" | |
b:7 + release | |
## Scrollwheel right | |
"~/.xbindkeys/MX-Master-3-bindings.sh Scroll_R" | |
b:6 + release |
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
#!/usr/bin/env bash | |
button=$1 | |
# Horizontal scroll sensitivity reduction | |
hScrollModulo=3 | |
hScrollIndexBuffer="/dev/shm/LogitechMXMaster3HScroll" | |
function temporizeHorizontalScroll { | |
local newDirection=$@; | |
# read buffer | |
local buffer=(`cat $hScrollIndexBuffer`) | |
local oldDirection=${buffer[0]} | |
local value=${buffer[1]} | |
if [ "$oldDirection" = "$newDirection" ]; then | |
# increment | |
((value++)) | |
((value%=$hScrollModulo)) | |
else | |
# reset on direction change | |
value=1 | |
fi | |
# write buffer | |
echo "$newDirection $value" > $hScrollIndexBuffer || value=0 | |
# temporize scroll | |
[ ${value} -ne 0 ] && exit; | |
} | |
case "$button" in | |
"Scroll_L") | |
temporizeHorizontalScroll "L" | |
xdotool key --clearmodifiers ctrl+shift+Tab; ;; # Previous tab | |
;; | |
"Scroll_R") | |
temporizeHorizontalScroll "R" | |
xdotool key --clearmodifiers ctrl+Tab; ;; # Next tab | |
;; | |
# ... | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Sebelino Thanks, I'll try it out.