Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Ubuntu/Gnome, is it possible to simulate ALT+TAB using a single alternative keystroke?

I would like to simulate ALT+TAB with a single key press (preferably the menu-context key) on my keyboard.

In order to simulate this correctly, it must act like the ALT key has been pressed first and then the TAB key is pressed after a tiny delay - on the other hand, if you simulate both keys being pressed at exactly the same time, I believe the task navigation menu does not appear.

Anyone know how to simulate this on Ubuntu?


Following John T's suggestion, I installed monodevelop, downloaded IronAHK and ran "make install all" and got this error:

/mainline/Scripting/IACodeProvider.cs(100,32): error CS1502: 
The best overloaded method match for
`System.CodeDom.Compiler.CompilerError.CompilerError(string, int, int, 
string, string)' has some invalid arguments /usr/lib/mono/gac/System
/ (Location of the symbol related 
to previous error) /mainline/Scripting/IACodeProvider.cs(100,32): 
error CS1503: Argument `#4' cannot convert `int' expression to type `string'
share|improve this question
Also tried to use gconf-editor as described here:… but it had no effect for ALT-TAB. – lipton Nov 4 '09 at 20:06
Hmm. The way that Alt+Tab works is fundamentally a two-key system. You hold down Alt, and then you press and release tab multiple times to cycle through windows. So if you set a single key to the Alt+Tab key combination, you would only be able to swap between the two most recently used windows. If you want to use a single key for window cycling, you'll have to explain how you want to get around this problem. – Ryan Thompson Nov 5 '09 at 17:34
up vote 2 down vote accepted

If you are using compiz as your windows manager, i.e. if you have enabled visual effects, simply install the compizconfig-settings-manager package. The start the settings manager via System -> Preferences -> CompizConfig Settings Manager. Now find the settings for the Application Switcher module and you can assign any keypress of your liking to the Next and Previous Window commands.

share|improve this answer
compiz seems to require a lot of heavy-duty processing resources which my ubuntu machine does not have. – lipton Nov 4 '09 at 20:03
Well. I said "If". I didn't want to encourage you to use compiz. – innaM Nov 4 '09 at 20:13
@Manni: Got it. Thanks. – lipton Nov 4 '09 at 20:55
Are there any solutions not involving compiz? It 1) crashes my OS (and I don't want to fix it). 2) Uses a different visual for scrolling through the apps – Sridhar-Sarnobat Jan 16 '13 at 20:33

Since you are not using Compiz, you should check out your options under System -> Preferences -> Keyboard Shortcuts. The Window Management section contains at least two entries that might be helpful here: Move between windows, using a popup menu and Move between windows immediately. Maybe you can assign a single key shortcut to one of those.

share|improve this answer
Thanks. Yes, in the comment above I mentioned that I tried to follow some instructions on… but as Wil pointed out above there is a delay required that does not seem to be compatible with those instructions. I tried setting "Move between windows" as "global settings" in gconf-editor but it had no effect. – lipton Nov 4 '09 at 20:54

New answer

I have been messing around for the past hour or so in order to come up with a solution, but I am stumped. What I have managed to do is make a macro that does Alt+Tab, then sends an additional Tab every two seconds... But I have no idea on how to terminate the script when you have had enough. (You only need to tap a key once to start)

I am wondering if any macro/Linux gurus can make a second macro or script that can terminate the macro from playing upon request - This simply works when you press one key and let go.

In Ubuntu, start by going to terminal and type:

sudo apt-get install xmacro

(Now, I am not the best Linux guy, but I am clueless as to why I couldn't find this in synaptic package manager, but I had to type it from the terminal).

Next, The script I made is (save this somewhere, I called it test.macro in my home directory)

KeyStrPress Alt_L

Then, copy and paste the following as many times as you want:

KeyStrPress Tab
KeyStrRelease Tab
Delay 2

To run this, you need to type the following (from the place that the macro is saved):

cat test.macro | xmacroplay ":0.0"

I created an alias/hotkey to the above command.

Again, This is not a solution, but hopefully a start point. I got close but after spending a lot of time, I cannot come up with a solid solution. Sorry, but hopefully this will get you closer.


As far as I know, it isn't possible.

I looked in various config files but cannot find a good way to replicate Alt+Tab due to the way it works.

Simply put, you need to hold one down whilst the other does the switching.

What I recommend you do and I can look in to it for you if you want, is to write a macro that automatically, upon one key being pressed, does Alt+Tab, then sends another Tab every couple of seconds. Letting go simply releases on the application currently selected.

share|improve this answer
Wil: you have understood the problem regarding the need for a delay between the keypresses. I would write a macro if I knew how - or in what technology/language to do so. ALT+TAB seriously aggravates my RSI pain in my wrist. That's why I'm offering all of my reputation as bounty for this. It's more than an inconvenience. It's actually a health issue. So if you could help me figure out how to create a macro I would really appreciate it. – lipton Nov 4 '09 at 20:49
Sorry, still no answer, but I have spent ages on this for you without much luck - however, hopefully it will get you a lot closer. – William Hilsum Nov 5 '09 at 0:03
Wil: Thanks for trying. I appreciate it. I'm going to see if the IronAHK suggestion may work better. – lipton Nov 5 '09 at 20:19
It should do, you are having the same problems as I did to install it, however, that script is much better and what I was trying to do without much luck! – William Hilsum Nov 5 '09 at 22:15
@Wil: Thanks for letting me know that you had similar problems installing IronAHK. Indeed that does not bode well for getting that solution to work. – lipton Nov 6 '09 at 3:53

Not quite what you're looking for, but may help your RSI? I use Superswitcher ( to supplement the default Metacity Alt-Tab. On pressing the "Windows" key on my keyboard (the "Super" key in superswitcher's lingo) a task list appears. List traversal is with Up/Down keys, can select with mouse click too. Cycling is through all windows in the current workspace in a fixed order (the order they appear on the taskbar).

Seemed alpha ver & unmaintained, but the 64bit .deb (from 2007) works on my 9.04 x86_64.

share|improve this answer
Thanks. I installed it. It's nice but I wish it had a way to configure the hotkeys to whatever you prefer. If I can't get any other option to work I may try to recompile it with my own key settings. – lipton Nov 5 '09 at 20:16

Use IronAHK, it's a complete rewrite of AutoHotkey that runs under Mono for Mac and Linux compatibility (it comes with a build script).

As for the code:

Send {Alt Down}
Sleep, 1000
Send {Tab}
   GetKeyState, state, Numpad1, P
   if state = U
   Sleep, 1000
   Send {Tab}
Send {Alt Up}

this would set the number 1 on your number pad to send the Alt-Tab sequence with a 1 second delay. Feel free to modify the code to your liking!

share|improve this answer
You are much better at AHK than me... but, read my answer - this comes with the exact same problems I have - basically, if you did this on your machine, it would just do alt+tab and let go of alt... which is useless and only goes back and forth... It needs a loop which presses tab and then lets go when you stop pressing 1, however, I tried for a while and got no where, as I don't know if it is possible to do loops etc. – William Hilsum Nov 5 '09 at 13:16
Ah, I sort of see what you're saying. I'll add a loop. – John T Nov 5 '09 at 13:25
I think that's the right logic. Send alt, wait a second before sending tab. Now the tab navigation window is open. If Numpad1 is still being held down, send a tab every second. When Numpad1 is released, let go of alt. – John T Nov 5 '09 at 13:35
I was trying to look at IronAHK in a VM and get it working... Guess you beat me! I seriously need to look at AHK, it looks brilliant! – William Hilsum Nov 5 '09 at 13:37
Should work, here's a preview on XP but I gotta run, will update later if there's problems: – John T Nov 5 '09 at 13:55

Make a script that re-binds the assigned key to:

  1. Start the script (Alt+Tab)
  2. Move down the app line (Tab)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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