Created
January 30, 2016 14:23
-
-
Save bharadwaj-raju/ca0458439159042a12f6 to your computer and use it in GitHub Desktop.
Multi-mouse config for X11
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
#!/bin/bash | |
# DoubleMouse.sh - Multi-mouse config + button swap for X | |
$mousename = $1 | |
if [[ $1 == '--help' || $1 == '' || $1 == '-h' ]] | |
then | |
# Show help | |
read -d '' help <<- EOF | |
Multi-mouse config for X11 | |
Usage: [ <Mouse model name, as shown in xinput> ] [ --help ] [ --undo | -u ] | |
EOF | |
echo "$help" | |
fi | |
if [ $2 == '' ] | |
then | |
xinput create-master "othermouse" | |
mouse=`xinput | grep "$mousename"` | |
mouseid=${mouse:50:2} | |
mouseid=${mouseid//[[:blank:]]/} # Remove spaces | |
xinput reattach "$mouseid" "12" | |
xinput set-button-map "$mouseid" 3 2 1 # Reverse controls for left hand | |
else: | |
mouse=`xinput | grep "$mousename"` | |
mouseid=${mouse:50:2} | |
mouseid=${mouseid//[[:blank:]]/} # Remove spaces | |
xinput remove-master $mouseid | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment