Remap a button from my gaming mouse to a keyboard key

I just installed ubuntu 18 on my PC and id like to know if there's a tool to remap my mouse side buttons to work as they were a key from keyboard. I used to use X-Mouse Button Controll on Windows but i can't find a alternative option to ubuntu.

My side buttons are shown in "xev" command as button 14 and button 15 and id like to lets say: press button 14 and it act like i pressed key 4 from keyboard, press button 15 and act like i pressed key 5 from keyboard.

The reason i want that is because i need a hotkey but the game does not recognize these side buttons.

thanks in advance!


Solution 1:

For anyone who has the same problem: I just achieved my goal using XTE, i found the solution after almost a week searching. Found this website https://matmunn.me/post/binding-volume-control-mouse-buttons-ubuntu/

It consists in installing xbindkeys and xautomation packages, in my case it was already installed, don't know if it's a default package. Next you need to edit a file called xbindkeysrc with command:

xbindkeys --defaults > ~/.xbindkeysrc

or

touch ~/.xbindkeysrc

all you need to do is to write there is a block of code that tells the system what to do if you press a particular key whether its a Mouse button or a Keyboard key. The code looks like this.

# button 8
"xte 'key 5'"
  b:8

which means, whenever you press "Button 8" (which is a side button on my mouse) act like i have pressed the keyboard "Key 5" . You can use the command xev to check what is the number of your mouse's button. Hope this can help other with the same problem.