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?

  • 3
    I think you have to set the alt key to release too. – Uri Herrera Apr 15 '12 at 3:25
  • @ fossfreedom I believe he means another invocation of xdotool. Like: xdotool keyup alt "simulation" because it is a simulation of the user doing something with the keyboard. – user344200 Oct 31 '14 at 7:06
"xdotool keydown alt key Tab; sleep 2; xdotool keyup alt"

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.


well, I think it over and found there is a workaround, you can just make another simulation to perform alt key release. This should be the most convenient way to simulate window switch with mouse gesture.

  • 5
    ... and for those of us who dont know what is a "simulation" and how to do this - perhaps you can explain this in your answer. Thanks. – fossfreedom Sep 7 '12 at 15:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.