After switching mouse buttons is with xinput, each computer restart resets the settings

How does one go about "saving" settings in Ubuntu? I change my buttons on my trackpad using xinput set-button-map 11 3 2 1 (I'm a lefty) and it works during that session. However, when I reboot my computer, I lose my setting change, and the mouse goes back to being right-handed.

How can I get the setting to "stick" indefinitely?

Thank you!

My Machine is:

Toshiba Satellite S50-B 64-bit Ubuntu version 16.04 LTS


Solution 1:

This should work to make it stick after log in:

Add the following command to startup Applications:

/bin/bash -c "sleep 15 && xinput set-button-map 11 3 2 1"

Open Dash > Startup Applications > Add, then add the command above.

Explanation

Adding a command to Startup Applications makes the command run on log in, so this will work from the moment you are logged in.

The sleep 15 is to make sure the desktop is fully loaded before the command runs. If you leave it out, the command either breaks, misses target or is overruled by possible local procedures, setting other values. This goes specifically for mouse, keyboard and screen (xrandr) related commands.