Alt-Tab is the common name for a
keyboard shortcuton Microsoft Windows3.1 onwards used for switching between top-level windows without using the mouse; hence it was named "Task Switcher" ("Flip" in Windows Vista). Casual users may press keypress|Alt-keypress|⇆ Tab to alternate between the two most recent tasks, but used to its full potential, Alt-Tab can switch to any running program. The list of tasks is kept in an order with the most recently used tasks at the front. Tab does not need to be pressed as many times to move the task selection cursor from the front of the list to a nearer task--the more recently used, the easier to get back.
Since its introduction in Windows, the Alt-Tab keyboard combination has also been incorporated to other widely used
operating systems, such as Mac OS Xand free software desktop environments such as KDEand GNOME.
The Precise Behavior
Alt-Tab is accessed by a somewhat unusual application of the keyboard. First the Alt key is pressed and held down. While Alt is down, Tab may be pressed and released repeatedly, sometimes combined with Shift if desired, to cycle the cursor through a list of tasks. A special task selection window appears the first time Tab is pressed with Alt down. The "release of the Alt key" is the act that closes the task selection window and switches to the selected task.
The fact that the menu is held open by keeping Alt pressed may seem unusual, given the way the modifier keys (Ctrl, Alt, and Shift) are typically used, but the behavior is quite intuitive and users quickly become accustomed to it.
The full capabilities of Alt-Tab are learned intuitively by many users. Its behavior has undergone few changes over the years and has many subtle features that define it.
The behavior can be defined by these rules:
* As long as there is more than one task window, the task list appears as soon as Tab is pressed with Alt down.
* The task list remains open until Alt is released.
* Tab moves the cursor forward in the list; Shift-Tab moves it backward. In the event that there are many windows, Tab or Shift-Tab can be allowed to
* With the initial press of Tab or Shift-Tab, the square selection cursor is placed onto the window immediately following or immediately before the active one. If there are no topmost windows above the active window, an initial Shift-Tab wraps the cursor around to the end of the list.
* Esc while Alt is still down aborts the switch.
* The windows are listed by their "
Z-order". Any windows which are "always on top" are kept at the head of the Z-ordersequence and are listed first, followed by the current window and the windows underneath it.
* Switching to a window moves it to the top of the
Z-ordersequence, moving it to the front of the list, with the exception that "always on top" windows remain topmost and at the front of the list.
* When the Alt-Tab window is not in use, Alt-Esc lowers a window, placing it at the bottom of the
Z-ordersequence. This sends it to the end of the list. Alt-Shift-Esc is equivalent to one Alt-Shift-Tab except that minimized windows are selected without being restored.
* Minimizing a window also sends it to the end of the list in the same way as Alt-Esc. Some applications, notably Outlook, violate this.
Windows Vista changed the default behavior [cite web
title=Windows Vista changed the Alt+Tab order slightly
accessdate=2008-07-31] (under most default installations) with its Flip interface. The six most recently used items in the Flip tab-order work as described, then remaining windows are ordered alphabetically by application path (and optionally grouped, depending on the 'group similar taskbar buttons' setting which is enabled by default).
These rules have certain interesting consequences (in the absence of "always on top" windows such as Task Manager):
* Pressing Alt, pressing Tab, releasing Tab, and releasing Alt (the typical way an Alt key combination is performed) will always alternate between the two most recent tasks.
* Alt-Shift-Tab can restore the most recently minimized window. (If there are "always on top" windows, the lowest of these will be selected instead.)
* Pressing Alt-Tab-Tab (two tabs with Alt continuously held down) provides the same feeling of a quick switch back and forth, but with three programs. The three programs are activated in sequence, repeatedly. In general, any number of tabs can be used to achieve this behaviour with any number of windows, though beyond a small number of windows it becomes tedious and is less useful.
* To expel one of three tasks from use in the above situation, minimize that window and Alt-Tab will immediately begin to behave as if the most recent two tasks were the two remaining.
* To abort the Alt-Tab, before releasing Alt one can press Shift-Tab to undo everything. (Or press Esc.)
A list of top-level windows is maintained with a continually updated ordering. When the selector menu is initially activated by Alt plus the first Tab, the list is populated this way:
* All "'always-on-top' top-level windows" according to
Z-order, front-to-back, if any exist
* All "ordinary top-level windows" according to
This list does not change while the selector remains open. On each new invocation of Alt-Tab, the order can change.
Windows may be divided into two categories, 'always-on-top' and ordinary. When a task is switched to, it is moved to the head of its category. For the following example, suppose there are no 'always-on-top' windows. Let "A" be the current window title. Hold down Alt and press and release Tab once, leaving Alt pressed. The window list comes up. "A" is guaranteed to be first in the list. Suppose the complete list is "A W Z E U B C". The selection cursor will initially be on "W". Suppose we want to switch to window "U". Without releasing Alt, press Tab three more times and then release Alt. Then hold down Alt and press-release Tab once leaving Alt down. The window list will now show "U A W Z E B C". Then Tab over to "E" and release Alt, selecting window "E". Press and hold down Alt and press-release Tab once leaving Alt down. The window list will now show "E U A W Z B C". Note that the windows switched to with Alt-Tab ("E", "U", "A") are in order of how recently they were switched to. Now Tab over to "A" and release Alt. Press and hold down Alt and press-release Tab leaving Alt down. The window list will show "A E U W Z B C". The effect of this most-recently-used behavior is that to return to the most recent task, Tab is pressed once, for the second most recent task Tab is pressed twice, and so on for all tasks. The priority of a window in terms of Alt-Tab accessibility is how recently it was used. If "A" is now minimized, the list will become "E U W Z B C A", and if "Z" is minimized the list becomes "E U W B C A Z". Thus minimizing a window mimics the effect of not using it for a long time.
The commonplace alternation between the 2 most recent tasks (using a fast Alt-Tab with all keys released immediately) is precisely a special case of the above behavior. Suppose the windows are "A B C" and we want to alternate between "A" and "B". Hold Alt while pressing and releasing Tab; continue holding Alt. The list will show "A B C" and the cursor will initially be over "B". When Alt is released "B" will be selected, Tab having been pressed a total of 1 time, and zero attention to the task selection cursor having been necessary. Again, press and release Tab while holding Alt. The list will show "B A C" and the cursor will initially be over "A". When Alt is released we have switched back to "A". Displaying the list again, the order has returned to "A B C" and this sequence can recur. On close inspection, in the course of typing Alt-Tab and releasing both keys quickly, the task list window can be observed to flicker for a split second, so .
If the user has been switching among 3 applications and wants to dispense with one of them by minimizing, one of the remaining ones will be on top immediately after minimizing, and ordinarily Alt-Tab will alternate between the 2 remaining windows. If a program fails to move to the end of the list when minimized, pressing Alt-Tab once will return to the minimized program. Failures such as this can result in a frenzied reordering of the Alt-Tab list by means of several Alt-Tab-Tab-Tab... sequences to compensate for the program misbehavior. The algorithm for this reshuffling is intuitive after using Alt-Tab for a long time.
If the user attempts to switch to an application using Alt-Tab but the application fails to update its place in the z-order (for example, if its window procedure is hung), then the next time Alt-Tab is invoked, the task selection cursor may initially point unexpectedly far into the list of icons, just past the application in question, which will not have been moved to the head of the list.
Applications have some say in where they are located in the Alt-Tab order. The list of windows is altered by the creation and destruction of windows, programmatic hiding, showing, raising, and lowering of windows, and alterations to the window
The order of the Alt-Tab list corresponds directly to the z-order, once the windows have been sorted according to 'always-on-top' status. Alt-Shift-Esc is equivalent to one Alt-Shift-Tab except that minimized windows are selected without being displayed. [cite web
title=What is the Alt+Tab order?
Windows-Specific Issues and Hacks
Alt-Tab works even if
Windows Exploreris no longer running. On Windows NT-based systems, Alt-Tab is managed by CSRSS(Client/Server Runtime Subsystem). It works even when Ctrl-Alt-Del and Ctrl-Shift-Esc ( Task Manager) (which are managed by Winlogon) do not. [cite web
title=Running Windows with No Services
work=Mark's Sysinternals Blog
Alt-Tab may be intercepted (or effectively disabled) by means of a low-level keyboard hook. [cite web
title=Win32 Q&A: Handy Features in Windows, and Interlocked Functions
accessdate=2006-09-24] Such a technique is used by applications such as the
Virtual Network Computing(VNC) viewer to pass Alt-Tab keystrokes to the remote desktop when the VNC window is active.
Windows XP, the Tweak UI PowerToycite web
title=Microsoft PowerToys for Windows XP
accessdate=2006-09-24] . can adjust the number of rows and columns in the task list window. This is helpful if there are so many windows that the list would spill over into multiple pages.
Another Microsoft PowerToy, Alt-Tab Replacement, is available for Windows XP that displays a
screenshotof each application in the task list rather than just its icon, and allows the user to use the mouse to select the desired application. A more advanced version of this functionality, named Windows Flip, is built into Windows Vista.
A number of third-party tools, similar to Alt-Tab Replacement, are also available that add additional functionality to Alt-Tab.
Windows Vistaallows the user to navigate through the alt-tab menu using mouse or arrow keys.
When the Aero Glass theme is enabled, Windows Vista also offers a 3D view of the windows themselves that animates as the user cycles through it. The behaviour is very similar to Alt-Tab and is accessed by holding down the
Windows keyinstead of Alt while pressing tab. While this view is visible, windows can be selected and made active by clicking on them with the mouse.
If there is only one window on the system, Windows does not show a selector dialog at all when Alt-Tab is pressed; the key sequence does nothing.
Similar functionality exists on
Mac OS Xusing Command instead of Alt, and switching between applications rather than windows. The Macintosh switcher has the additional capabilities of pointing at the desired icon with the mouse, dropping files on applications' icons, and switching applications midway through a drag-and-drop operation. Selected application can be hidden or closed using H or Q button without closing the menu. Command-` works similarly to switch between windows within the same application.
In the classic
Mac OS, third party extensions (such as "LiteSwitch") provided this behavior.
Unix-like desktop systems such as
fvwm, KDE, and GNOMEhave added a compatible function. On some systems including Sun's CDE and old versions of fvwm, the Alt-Tab key combination is mapped to less sophisticated functionality such as only alternating between two windows, cycling forward or backward in a list of all windows in a fixed order, or opening a task applet in which you have to use arrow keys or the mouse to select a task and then click or push Enter. Some window managers such as WindowLabforego the onscreen window list and simply bring each window to the front in turn as Alt-Tab is pressed.
Not all window managers provide this functionality as a core feature. For example,
Blackboxdoes not; users desiring this behavior can add it by running a helper application such as "bbkeys".
Compiz Fusion(aka Beryl, Compiz) has similar functionality, but displays a preview of the window as well as its icon. It also makes use of Alt-Shift-Tab by moving backwards through the displayed programs, and it is possible to activate a Windows Flip 3Dalternative using the Windows keyand Tab.
GNOMEwindow manager has similar functionality to versions of Windows released before Vista, with the added feature of displaying the outline of the currently selected window on the screen.
The Alt-Tab key combination to switch between windows has been present in all versions of Windows since
Windows 1.0. However, there was no visual indication of the list of windows available when switching between windows until Windows 3.1, when this feature was introduced as the 'Fast "Alt+TAB" Switching' checkbox in the Display control panel applet, internally known as "CoolSwitch" [ [http://support.microsoft.com/kb/83433 Windows 3.1 Resource Kit WIN.INI Section Settings ] ] .
Before CoolSwitch, the Alt-Tab combination was similar to the Alt-ESC combination (which also switched windows), but Alt-ESC redrew each window immediately on each stroke, while Alt-TAB brought the windows to the top but did not redraw them until the Alt key was released.
An example of a program that violates the expectation that pressing Alt-Tab one time will switch to the previous application is
Adobe Reader7.0.x. Like newer versions of Microsoft Wordit attempts to give a separate icon in the Alt-Tab task menu to each MDI document. However, unlike Word, it brings two items to the front of the list whenever a document is selected using Alt-Tab: first an icon representing the main Reader window and then an icon for the individual document. While in Adobe Reader, pressing Alt-Tab one time selects the second item in the list, which is the icon for the PDF document. Adobe Reader remains the current task when Alt-Tab is released. Thus it is demonstrated that the correct operation of Alt-Tab, like some other aspects of the Windows environment such as the Clipboard chain, depends on individual applications being written correctly.
Table of keyboard shortcuts
Windows Alt keycodes
Wikimedia Foundation. 2010.