Quick, dirty and cheap way to get a left-handed mouse on Linux (tested on Ubuntu only).
Just place this function in your ~/.bash_aliases
file:
# Left-handed mouse buttons
function left_hand_mouse () {
xinput list | grep -e "id\=.*slave\s*pointer" | while read -r LINE ; do
DEVICE_NAME=$(echo "$LINE" | cut -f 1)
DEVICE_ID=$(echo "$LINE" | cut -f 2 | cut -d= -f 2)
echo -e "Switching mouse button for $DEVICE_NAME\tDEVICE ID = $DEVICE_ID"
xinput set-button-map $DEVICE_ID 3 2 1
done
}
Don't forget to source the changes:
$ . ~/.bashrc
To switch the mouse button positions to left-handed, call the function from the terminal:
$ left_hand_mouse
This is simple and elegant solution, should have worked, but got stuck and not working.
I also get the following warning
WARNING: running xinput against an Xwayland server. See the xinput man page for details.
Digging into this pesky issue, this iswhat I have done so far:
Is there a simple fix for this on Xwayland Server?