Alt Tab with xdotool and xkeybind

I'm trying to map alt tab behavior to a mouse button using xdotool in my .xbindkeysrc. What I want to do is map something like

"xdotools keydown alt key Tab"
release b:7

but by doing this the alt key gets stuck, and it prevents my other mappings from working until I press the alt key on the keyboard. Is there a way to do this without having to press the alt key to get things unstuck? Without keydown it just switches back and forth between two windows, with keydown it behaves like I want (displaying the alt-tab switcher) but the alt key is stuck. Is there a way to unstick the key after using the alt tab switcher using xdotools?


Solution 1:

"xdotool keydown alt key Tab; sleep 2; xdotool keyup alt"
b:7

The sleep interval allows me to access the menu and choose, and then it closes automatically. It's probably not the best solution but it works. If anyone has a better alternative please let me know. I find that xbindkeys only seems to work intermittentlly. It does not work on the overview (not for this command, but for a button tied to the super key. And after installing docky, I fnid that it does not work unless there is an open window available in the workspace. Odd behavior.

Solution 2:

Alternative which works for me.

3-finger swipe right:

xdotool keydown 0xffea + key 0xff09

Explanation:
▪It simple holds ALT and presses TAB at same time.
▪This allows access the menu.
▪Once you select from menu you have to to release the holded ALT key by performing 3-finger swipt left operation.


3-finger swipe left:

xdotool keyup 0xffea

Explanation:
▪ It simple releases the ALT key.
0xffea is value of ALT key.
0xff09 is value of TAB key.

Please note that both commands must be executed, otherwise the system gets stuck. It then is not possible anymore to enter any text, because the Alt key has not been released.