Question summary: I want one of my mouse buttons to be registered as the left Windows button Super_L by X11.
In my window manager, I can move windows around by holding the "left Windows button" (Left Super) and dragging a window with the left mouse button. I want to be able to do that without touching the keyboard, so I want to map the left Super key to mouse button 11, that way I can hold mouse button 11 and click+drag windows.
The most obvious solution is using xbindkeys and xte like this (.xbindkeysrc
):
"xte 'keydown Super_L'"
b:11
"xte 'keyup Super_L'"
b:11 + release
This works like this:
- When I press down mouse button 11, Super_L is also pressed down
- When I release mouse button 11, Super_L is also released
But there's a problem: I can't move windows using Super_L + Mouse1 if I'm also holding down another mouse button, like Mouse button 11. Using the solution above, mouse button 11 is still being registered as pressed and released, and so none of the window manager operations work.
I have tried this using both Cinnamon and Awesome WM, and absolutely none of the Super_L keyboard combinations work while mouse button 10 or 11 is being held down.
A subpar hack
I'm currently working around this issue by causing the mouse 11 click to hold the Super_L button for a certain amount of time. That way I can click the mouse button, then drag stuff around for a brief period afterwards:
"xte 'keydown Super_L' 'usleep 250000' 'keyup Super_L'"
b:11
Another attempt
As suggested by totti, I tried this xbindkeys
configuration:
"xte 'mouseup 10' 'keydown Super_L'"
b:10
"xte 'keyup Super_L'"
b:10 + Release
It doesn't work. It seems the Super_L key is being held down, because as soon as I release button 10 it remains held down for ever (until I press the Super_L key again on the keyboard) but the mouse button is still being registered, because I can't click&drag windows. I don't think I'm going to be able to make this work using xbindkeys
and xte
.