System: Ubuntu MATE 17.04
I use control\shift + [key] keybinds often, and plan to use lot of hotkeys with those modifiers. Because sometimes using grid layout I will need to be pressing buttons like "F5-F8" with modifiers, or use "q", "a", "z" (which are pressed with pinky finger) with shift\control, having to shift whole hand to do that can be sub-optimal, unless you have both hands on keyboard, so when you use mouse it makes such hotkeys not optimal.
For that reason I am in need to bind additional mouse keys to be "Shift\Control" modifiers, so I could press "Mouse_8 + [key]" and it would process it as "Shift + [key]".
Because there are hotkeys with ctrl\shift all across keyboard, and because shift press can be used by itself to modify mouse panning behavior, just binding each "Mouse_8 + [key]" separately is no good.
For example I could just do separate binds like this:
"Mouse_8 + F1" = "Shift + F1"
"Mouse_8 + F2" = "Shift + F2"
"Mouse_8 + F3" = "Shift + F3"
"Mouse_8 + F4" = "Shift + F4"
But this would create need to have complex
xbindkeyscript, complicate rebinding process, and it will mean using mouse button in same way as shift for panning will be impossible.
What I tried:
xmodmap -e "Pointer_Button8 = Shift_R"and the like (it does not recognize mouse buttons above 5, so there are no Pointer_Button8 for it to process)
xbindkeys with normal
.xbindkeysrc config file like this:
"xdotool keydown Shift_L" b:8 "xdotool keyup Shift_L" Shift + b:8 + Release
xbindkeys with Guile based config in
;; This configuration is guile based. ;; http://www.gnu.org/software/guile/guile.html (define actionperformed 0) (define (first-binding) "First binding" ;; backwards\left side mouse button (xbindkey-function '("b:8") b8-second-binding) ) (define (reset-first-binding) "reset first binding" (ungrab-all-keys) (remove-all-keys) (first-binding) (grab-all-keys)) (define (b8-second-binding) "Backwards Button Extra Functions" (ungrab-all-keys) (remove-all-keys) (run-command "echo b8 Pressed!") (run-command "xdotool keydown Shift_L") (xbindkey-function '(release shift "b:8") (lambda () (run-command "echo b8 Released!") (run-command "xdotool keyup Shift_L") (reset-first-binding) )) (grab-all-keys) ) ;; (debug) (first-binding) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; End of xbindkeys configuration ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Current wall for this solution is fact that xbindkeys blocks anything else from processing key combinations with shift until mouse button is released.
In other words, when I press Mouse_8 it does correctly send command of Shift_L going down, but any hotkeys will not be processed because xbindkeys does not release control of it until you unpress Mouse_8.
Because there is no event like "Mouse_8 down" in xbindkeys,I struggle to find solution.
Trying to emulate "Mouse_8 up" after making it hold down shift to make it think we released button does not work either (I've tried making it
"xdotool keydown Shift_L mouseup 8", but xbindkeys did not process it as Mouse_8 being released).
What alternative solutions can I try to bind mouse key as shift modifier, or how can I implement solution in
xbindkeys\make it think we releases button so it released control before "release b:8" event?