-
-
Save Djuuu/0a576ec006ba23c24c9576d6a36baaed to your computer and use it in GitHub Desktop.
## 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 |
#!/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 |
@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
like xdotool key --delay 100 Control_L+Tab
. I don't see any difference either by adding release
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.
@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:
@jmarcet That's just a small temporary file. You can create it yourself it it already exists. If you don't have a
/dev/shm/
, you can alternatively store the file below/tmp/
. In my own version of the script, I am creating the file if it doesn't already exist.