Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.