Remapping mouse buttons and keyboard keys could be a difficult thing to do in Linux due to the X Window System (X11) and Wayland confusion. However, there is a GUI tool written in Python called Input Remapper that can help you remap devices with ease. It supports both protocols, and remembers the configuration after rebooting.
input-remapperwas formerly named as
.debfile from release page then:
$ sudo apt install /path/to/deb/file
$ yay -S input-remapper-git
Don't know how to install packages on Arch-based Linux? A full guide on Two Ways to Install Packages from AUR on Arch Linux/Manjaro.
For other Linux distros or if you preferred managing
$ sudo pip install --no-binary :all: git+https://github.com/sezanzeb/input-remapper.git
Enable the service manually:
$ sudo systemctl enable input-remapper
Remap the buttons/keys of your selected device:
Don't forget to click apply after configuration.