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 |
@jmarcet By TOP, do you mean the Smart Shift button? One way is to create a couple of new rules in Solaar: one for pressing the button, one for releasing it. If pressed, a 1
is written to a different file below /dev/shm/
. If released, a 0
is written. Then adjust the script in this gist so it reads this file and executes xdotool
conditionally based on the file contents.
@Sebelino Thanks, I'll try it out.
@Sebelino At the moment I've settled with this and it's working beautifully:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Sebelino Yeah, my bad, I had an error in the script and for a moment I thought it was something like the synaptics driver has.
Anyhow, once I saw it working I don't see any benefit from it, you can get the same kind of delay directly with
xdotool
likexdotool key --delay 100 Control_L+Tab
. I don't see any difference either by addingrelease
to the button event.I'm still looking for a way to get the TOP button as a modifier which I can then mix with the thumb wheel, and only do the
Ctrl+Tab
if pressed together.