Setting up
-
2. Installing Xinput
Now to Install Xinput Utility for Ubuntu
Simply play:sudo apt install xinput
Authenticate with the User Admin Pass.
If Got “User is Not in Sudoers file” then see: How to Enable sudo. -
3. Finding out Device Name
So to Display Devices List
Run:xinput list
Select & Copy Device’s Name with Ctrl+x.
Or simply take note of the Device’s ID.
But if No Device Name but “xwayland” on GNOME Wayland then instead follow the linked Guide:How to Swap Mouse Buttons on GNOME Wayland
-
4. Swapping Mouse Buttons
Now to Remap Mouse Buttons Map on Ubuntu
First, to list the Current Map run:xinput --get-button-map [DEVICEIDNAME]
You can use either the Device ID or Name.
So as in this example:xinput --get-button-map 13
Now for instance to Switch Buttons 1 and 3 simply play:
xinput --set-button-map 13 3 2 1
So it’s enough to input the part of the sequence that you intend to Change, but Starting from the head!
Next to Check your new Setup again:xinput --get-button-map 13
How to Find the Mouse Button ID
-
5. Making Permanent Config
Last, to make a Permanent Xinput Configuration File
For a Single User using the nano editor, put your both Commands into:nano ~/.xsessionrc
Ctrl+x to Save & Exit from nano Editor.
So the setup should be consistent also after Reboot.
Contents