Tuesday, July 4, 2017

rotate mouse scroll direction

*** v1-- scroll.sh ***
#!/bin/sh

direction=$1
echo $direction
if [ $direction = "horizontal" ]; then
    xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10'
elif [ $direction = "vertical" ] ; then
    xmodmap -e 'pointer = default'
fi




-- accept input horizontal and vertical,
$ sh scroll.sh horizontal 
to get it the scroll button to scroll horizontal


*** v2 -- scroll.sh ***
#!/bin/sh
on()
{
  xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10'
#  xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10 11 12'
}

off()
{
  xmodmap -e 'pointer = default'
}

if xmodmap -pp | grep -q '4.*6'; then
  off
else
  on
fi



- act as on and off script, run one time it is horizontal scroll and other time it vertical scroll


No comments:

Post a Comment