Windows – Disable MRU in Alt+Tab task switch

alt-tabwindows 7windows xp

Is it possible to disable most-recently-used ordering of windows' task switching (alt-tab) and use cycling instead? ie., always the same order (no matter how you use, independent of z-order).

I found a workaround with autohotkey called taskbarnavigation by robertcollier4, based on activatebynum.

It's great! Some issues though: it doesn't feature that built-in "icon cycle window" (?) that windows shows when you press Alt+Tab in bare Windows. Also the .ahk script is said not to work in Windows 7. Also, it's performance is not perfect. Furthermore I may not want to activate every single window along the way.

UPDATE: with TaskbarNavigation 1.3, the performance issues can be resolved, thanks to RobertCollier4!

Is there a(n other) way to change task-switching order from MRU to cycle-in-order?

Best Answer

For Win7, the tool 7+ Taskbar Tweaker can assign a keyboard shortcut to cycle back and forward in visual taskbar order. See the help file under section Advanced>Keyboard Shortcuts. It lets you assign key codes to actions 101 and 102:

101 - Switch to the window which is located on the left to the active window on the taskbar. 
102 - Switch to the window which is located on the right to the active window on the taskbar. 

For Windows XP, which is still a preferred OS to me due to superior responsiveness of UI - TaskbarNavigation seems to be the only currently available solution. There were previously some quirks with Windows not allowing applications to steal focus causing the window to not come to focus but only flash on taskbar. See SetForegroundWindow restrictions problem for which TaskbarNavigation implements some hackish Dllcalls.

However with recent investigation, there may be better methods with SystemParametersInfo(win32con.SPI_SETFOREGROUNDLOCKTIMEOUT or emulating the Alt key before switching or DllCall to RegisterHotKey.

If you want to provide some more feedback on the AutoHotkey forum regarding where performance is to be desired, perhaps it can be improved/fixed/perfected. Adding "#UseHook, Off" may also fix problems.

Cross-linking to related: