Map Ctrl and Alt to mouse thumb buttons
        Posted  
        
            by 
                murphyslaw
            
        on Ask Ubuntu
        
        See other posts from Ask Ubuntu
        
            or by murphyslaw
        
        
        
        Published on 2012-07-10T20:34:14Z
        Indexed on 
            2012/07/10
            21:24 UTC
        
        
        Read the original article
        Hit count: 301
        
mouse
I'm running Ubuntu 12.04 and have a multi-button Microsoft mouse. I would like to map the CTRL and ALT modifier keys to the left and right thumb buttons of my mouse, respectively, so I can ctrl-click and alt-click without touching the keyboard. My thumb buttons are buttons 8 and 9.
I tried the solution in this question: How do I configure a mouse thumb button? which explained how to map a double click to a thumb button - this worked for the double-click but I couldn't figure out how to modify the solution for CTRL and ALT
I also tried this: How to map Ctrl/Shift to thumb buttons of Mouse? which used xdotools and xbindkeys. I modified the script to this:
~/.xbindkeysrc:
"xdotool keydown alt"
        b:9
"xdotool keyup alt"
        release + alt + b:9
"xdotool keydown ctrl"
        b:8
"xdotool keyup ctrl"
        release + control + b:8
Which ALMOST works. It simulates a CTRL-key press when I click the left thumb button, but I can't actually hold the button and click at the same time - holding the thumb button seems to prevent it from listening to other input until it is released.
Does anyone know how I can make my mouse thumb button actually work as a modifier key, so I can use thumb_button+click instead of CTRL-click?
© Ask Ubuntu or respective owner