Alt Tab with xdotool and xkeybind

34,164
"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.

Share:
34,164

Related videos on Youtube

Gary
Author by

Gary

Linux hobbyist since I was thirteen. Enjoy toying with computers, hated working with them.

Updated on September 18, 2022

Comments

  • Gary
    Gary over 1 year

    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?

    • Admin
      Admin about 12 years
      I think you have to set the alt key to release too.
    • Admin
      Admin over 9 years
      @ 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.
  • nilsonneto
    nilsonneto over 11 years
    ... 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.
  • Admin
    Admin over 3 years
    the command alone keeps the locked state of the alt key
  • Admin
    Admin almost 3 years
    took me a while to get unstuck with this. Luckily I switched to the laptop's built-in keyboard (which worked).