Skip to content

Instantly share code, notes, and snippets.

@bharadwaj-raju
Created January 30, 2016 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bharadwaj-raju/ca0458439159042a12f6 to your computer and use it in GitHub Desktop.
Save bharadwaj-raju/ca0458439159042a12f6 to your computer and use it in GitHub Desktop.
Multi-mouse config for X11
#!/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