I have a fairly standard Logitech M510 wireless mouse with the three regular buttons, forward and back buttons, and scrolling and sidescrolling. The forward and back buttons are worse than useless because when I accidentally press them they can close a newly opened tab or other undesirable behavior. I would like them instead to function as control and alt. Using xev, I determined that they are buttons 9 and 8 respectively. I tried to use
xmodmap -e "pointer = 1 2 3 4 5 6 7 Alt_L Control_L" but xmodmap would not accept a list of pointer buttons with keys in it. Then I tried using xbindkeys and xautomation, setting up the following .xbindkeysrc:
"xte 'keydown Alt_L'" b:8 "xte 'keyup Alt_L'" Release + b:8 "xte 'keydown Control_L'" b:9 "xte 'keyup Control_L'" Release + b:9
Then ran xbindkeys. Previously when I'd not split up the keydown and keyup parts the forward and back dysfunctionality had been suspended but no alt or control happened. The keydown and keyup setup was extremely problematic because once I pressed the back button the alt key was for most intents and purposes stuck down as far as key combinations were concerned and I could not type anything, although when I held the back button alt + click behavior returned to just click behavior and either way I had to hold alt on the keyboard to switch to another terminal and kill xbindkeys. How can I actually remap these buttons? I would prefer to use xmodmap or at least xbindkeys, but I appreciate any solution. At worst I know I can have the buttons do nothing by using
xmodmap -e "pointer = 1 2 3 4 5 6 7 0 0".