39
22
Is there a shortcut in Windows 7 to switch between windows in a given application only? I very much like this feature in OS X; what is its equivalent in Windows?
39
22
Is there a shortcut in Windows 7 to switch between windows in a given application only? I very much like this feature in OS X; what is its equivalent in Windows?
47
If it is one of the first ten applications on the taskbar, then (Win)+n, where n is its position number, will select it and cycle through the windows. (Use 0 (zero) for the tenth application.) For example, I have Windows Explorer and Internet Explorer pinned as the first two things on my taskbar, so I can use +1 to cycle through my directories and +2 to cycle through my browsers.
Some odd notes:
If you press and hold and type (and release) a digit n, Windows will open the nth application on the taskbar. Repeatedly tapping n will cycle through the windows of that program, as discussed above. As stated by TranslucentCloud, if you then type Shift+n, it will cycle through them in reverse order, as with Alt+Tab and Ctrl+Tab, etc.
If the nth application on the taskbar is pinned but not running, then +n will start it.
1This doesn't seem to work on a multi screen setup where you extend the taskbar – Erfan – 2015-02-20T03:35:35.940
1Great. And Win+Shift+1 cycles through windows reversely. – Neurotransmitter – 2018-01-10T13:23:25.170
Windows 10 users, see my answer below (Ctrl+Win+Number). Not sure if it works on Win 7/8. – Taylan – 2019-12-29T13:43:49.223
24
In Windows 7 and 8, although there is no shortcut I know of available from the keyboard alone, you can hold Ctrl while clicking the taskbar icon of the app you're interested in. Each time you do this a different window belonging to that app will come to the forefront.
In addition, the program VistaSwitcher sets up Win+F11 and Alt+` to switch between the current app's windows. (BTW, its web site says Windows 8 is not supported, but I've had luck with it under 8.1; the only problem I've seen so far is that it sometimes lists things like the search sidebar as open windows. I just ignore that, but YMMV.)
2HUGE quality of life improvement. While a dedicated hotkey would be more ideal, the WIN+# solution is severely limited by number of keys, poor ergonomics, and a dreadful delay, not to mention creating conflict between accessible hotkeys (1-4) and desired start bar location. – bpcookson – 2015-09-08T11:43:45.207
1VistaSwitcher is beautiful. Thanks for the suggestion. – Dustin Oprea – 2016-03-09T19:34:50.830
You can also add items to the exclude list like the "New notification" and "Cortana" on Windows 10. – dragon788 – 2016-05-29T23:02:11.017
Could you elaborate, dragon788? – echristopherson – 2016-05-30T22:34:33.923
1i love vista switcher program. – Luke – 2016-10-24T08:28:37.097
1looks like the successor to vistaswitcher, which is named alt-tab terminator
doesn't have the feature to tab between same application anymore – starcorn – 2019-05-07T08:00:35.863
23
You can use AutoHotkey: www.autohotkey.com
And put this script there:
!`:: ; Next window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
IF WinClassCount = 1
Return
Else
WinGet, List, List, % "ahk_class " ActiveClass
Loop, % List
{
index := List - A_Index + 1
WinGet, State, MinMax, % "ahk_id " List%index%
if (State <> -1)
{
WinID := List%index%
break
}
}
WinActivate, % "ahk_id " WinID
return
!^`:: ; Last window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
IF WinClassCount = 1
Return
Else
WinGet, List, List, % "ahk_class " ActiveClass
Loop, % List
{
index := List - A_Index + 1
WinGet, State, MinMax, % "ahk_id " List%index%
if (State <> -1)
{
WinID := List%index%
break
}
}
WinActivate, % "ahk_id " WinID
return
Works very well for me. Using Autohotkey I also made my copy/paste/undo,... keys like Mac. Works great!
Eras
2This works great with some caveats: 1) For Chrome, it will cycle all Chrome-like windows including applications like Slack! 2) For modern apps -- and if you only have one modern-app window open -- it will open a random other modern app (i.e. if you have Calendar open and that's the only modern app open, it will open "Settings", or "Sports", or "Mail", etc.) – Kirk Woll – 2016-03-07T22:02:52.557
@KirkWoll That's right. There is definitely room to improve it. I have not had the time to really dig into Autohotkey to make it happen... – Seperman – 2016-03-09T18:53:20.823
Great job, used it right away, thanks. A few points: WinGet, List
returns the number of windows in the List
variable (as opposed to the List%n%
pseudoarray in which the handles are stored), so you can skip the WinGet, WinClassCount
call and check for List
instead. Also, the code seems to be identical for both hotkeys. – Lebenita – 2016-09-01T07:01:28.467
it's doens't work with me on Windows 10 64bit and Microsoft Office 2016. can you help ? – Luke – 2016-10-24T08:23:02.117
1This works well, however, it seems to switch between ALL windows regardless of desktop. I am using task view extensively and need to jump through windows on the same desktop only. – petr – 2016-11-23T18:36:52.640
@Seperman Any idea how to make the above task-view aware? – petr – 2016-12-02T10:54:18.613
@petr I made this with a limited knowledge of Autohotkey syntax. It can definitely be improved but I have not had a chance to work on it. Here is the full version of the script that I use. It also makes the windows keyboard act like mac keyboard: https://gist.github.com/seperman/8064659
– Seperman – 2016-12-05T19:34:10.5108
Thanks, Erasmose, but your version of the autohotkey script will minimize a window if there are no other windows of that type. Sometimes you don't know, and minimizing is an annoying way to find out, so I modified your script like so:
!`:: ; Next window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
IF WinClassCount = 1
Return
Else
WinSet, Bottom,, A
WinActivate, ahk_class %ActiveClass%
return
!+`:: ; Last window
WinGetClass, ActiveClass, A
WinActivateBottom, ahk_class %ActiveClass%
return
oh, and I also changed last class to use shift instead of ctrl since I that's the modifier to go backwards with several other keyboard shortcuts. I love autohotkey.
1Cool. I updated my code based on yours and also a feedback I got on Autohotkey's forum. The new code won't loop through minimized windows just like how it is in Mac. – Seperman – 2014-10-17T04:09:07.387
@Seperman what if I want to loop through minimized windows as well. What do I have to change in your script to do that. – Ghos3t – 2018-03-09T09:42:18.327
This works well, except that it won't behave correctly with Chrome or Chrome/Electron-based apps (like VS Code and Slack), as it cycles through all of them. – otter.pro – 2019-07-29T15:04:11.417
Instead of using window class name, I used process name to play nice with Electron based apps and Firefox/Thunderbird. Script at https://gist.github.com/snmishra/794c5f41693510c46ba9bedc839696a8
– Satya Mishra – 2019-09-13T15:10:19.9237
Some applications that implement MDI provide Ctrl+Tab to switch between "Documents" under the same application instance. e.g. MS Office. But this is not a windows feature and is application dependent. For other software there are different short-cuts. e.g. Firefox does not provide this feature but there is an add-on that adds the functionality.
Additionally, here's a list of keyboard shortcuts provided in windows.
Also, there are existing discussions about Keyboard short-cuts in Windows.
Hope that helps.
2Also, some programs use (Ctrl)+(F6) for this. (Add (Shift) to reverse direction.) – Scott – 2014-01-15T22:16:21.917
5
Easy Windows Switcher from Neosmart does exactly what you are after.
Here is the description from the Easy Windows Switcher Website
Easy Window Switcher makes switching between different windows as easy as alt+` (that's alt+backtick) like on a Mac. Forget having to
alt+tab
between a million-and-one different open windows to find the one you are looking for, with Easy Window Switcher, tabbing between windows of the same program is only a alt+` away.
1doesnt "always" work. If I'm working on a different application for some time, then come back, it stops working. – Dushyant Bangal – 2017-08-25T07:55:41.870
4
VistaSwitcher allows or for this feature. Its compatible with Windows 10, (although the name suggests otherwise). On Windows 8 and up, I suggest adding certain metro apps to the exclude list.
The top answer is good, but doesn't work on multi-monitor setups where the taskbar is set to only show icons on active monitor.
Win + n does work on my W7 system with multiple screens and the taskbar showing on main monitor only – is this what you meant or is there really a way to make the taskbar switch to the currently active monitor (which I imagine would be distracting)? – Lebenita – 2016-09-01T05:24:27.050
3
I created an AutoHotkey script to switch between same application's windows that work with regular Window Apps, Chrome Shortcuts and Chrome Apps.
In that Github repo there is another AutoHotkey script that could work well in tandem with this one, because you will be able to Open, Restore or Minimize your Apps using the hotkeys you want.
Example:
F7:: OpenOrShowAppBasedOnExeName("C:\Windows\System32\SnippingTool.exe")
F8:: OpenOrShowAppBasedOnWindowTitle("Gmail", "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --app=https://mail.google.com/mail/")
2This is the only answer that works on Chrome correctly, as it doesn't treat Chrome and Electron-based app as same. It works perfectly on Chrome, VS Code, Slack, etc. (On rare cases, it didn't cycle correctly on certain apps like Mintty/Cygwin, gVim, and sometimes on Powershell, if the title of windows got changed) – otter.pro – 2019-07-29T15:24:50.507
1This needs to be the top answer. The other answers do not work with Chrome or VS Code, this one does. Thanks Juanma! Stopped me from needing to switch back to Linux. – Jeremy Bernier – 2020-01-08T23:59:15.963
1
In addition to what Scott (https://superuser.com/users/150988/scott) shared:
ctrl+repeatedly click over the app icon in the task-bar also will do the job.
1(this answer already given by another user) – Pete Alvin – 2018-05-15T14:07:09.537
1
With AutoHotkey too, a more natural behavior:
; Switch between windows of the same application with Alt+(key above Tab)
; Icon: made by Freepik (www.freepik.com), licence CC 3.0 BY
; from https://www.flaticon.com/free-icon/switch-window_71630
; Script Licence: CC0 (Public Domain)
; Source: https://framagit.org/dr4Ke/AutoHotkey_scripts
KeyName := GetKeyName("sc029")
Menu, Tray, Tip, Switch between windows of the same applications with 'Alt+%KeyName%'
*!SC029::
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
If WinClassCount = 1
Return
WinGet, List, List, % "ahk_class " ActiveClass
index := 0
if not GetKeyState("Shift") {
index := 1
}
;MsgBox, Entering Loop
While GetKeyState("Alt") {
If GetKeyState("Shift") {
index := Mod(List + index - 2, List) + 1
} else {
index := Mod(List + index, List) + 1
}
WinGet, State, MinMax, % "ahk_id " List%index%
if (State == -1)
{
continue
}
WinID := List%index%
WinActivate, % "ahk_id " WinID
ErrorLevel := 1
sleep 50
While (ErrorLevel != 0) and GetKeyState("Alt") {
KeyWait, sc029, DT1
}
}
return
0
I created an AutoHotkey script that integrates nicely with Windows Task Switcher (Alt+Tab), providing all of its benefits: previews of app windows, click to select, arrow key navigation, only activate the single window that you want. Invoke/navigate with Alt+` and Alt+Shift+` (backtick) to cycle between windows having the same process name as the current window. I find this more usable than Win+num as it works for any app (rather than having to remember the pinned slot number), window previews are larger, the background doesn't get blurred and it mixes seamlessly with Alt+Tab navigation. Tested on Windows 10.
The main trick is to temporarily hide non-target application windows from Task Switcher by setting WS_EX_TOOLWINDOW
and unsetting WS_EX_APPWINDOW
. In order to set these windows styles on windows running as administrator, AutoHotkey needs to be signed or run as admin. I followed the very easy signing instructions here.
Some related threads that contributed:
!`::
{
WS_EX_TOOLWINDOW = 0x80
WS_EX_APPWINDOW = 0x40000
tw := []
aw := []
WinGet, processName, ProcessName, A
DetectHiddenWindows, Off
AltTab_window_list(1)
Loop, %AltTab_ID_List_0%
{
wid := AltTab_ID_List_%A_Index%
WinGet, processName2, ProcessName, ahk_id %wid%
if (processName2 != processName)
{
WinGet, exStyle2, ExStyle, ahk_id %wid%
if (!(exStyle2 & WS_EX_TOOLWINDOW))
{
tw.InsertAt(0, wid)
WinSet, ExStyle, ^0x80, ahk_id %wid%
}
if ((exStyle2 & WS_EX_APPWINDOW))
{
aw.InsertAt(0, wid)
WinSet, ExStyle, ^0x40000, ahk_id %wid%
}
}
}
Send {Alt Down}{Tab} ; Bring up switcher immediately
KeyWait, ``, T.25 ; Go to next window; wait .25s before looping
if (Errorlevel == 0)
{
While ( GetKeyState( "Alt","P" ) )
{
KeyWait, ``, D T.25
if (Errorlevel == 0)
{
if (GetKeyState( "Shift","P" ))
{
Send {Alt Down}{Shift Down}{Tab}
Sleep, 200
}
else
{
Send {Alt Down}{Tab}
Sleep, 200
}
}
}
}
Send {Alt Up} ; Close switcher on hotkey release
for index, wid in tw
{
WinSet, ExStyle, ^0x80, ahk_id %wid%
}
for index, wid in aw
{
WinSet, ExStyle, ^0x40000, ahk_id %wid%
}
}
return
AltTab_window_list(excludeToolWindows)
{
global
WS_EX_CONTROLPARENT =0x10000
WS_EX_APPWINDOW =0x40000
WS_EX_TOOLWINDOW =0x80
WS_DISABLED =0x8000000
WS_POPUP =0x80000000
AltTab_ID_List_ =0
WinGet, Window_List, List,,, Program Manager ; Gather a list of running programs
id_list =
Loop, %Window_List%
{
wid := Window_List%A_Index%
WinGetTitle, wid_Title, ahk_id %wid%
WinGet, Style, Style, ahk_id %wid%
If ((Style & WS_DISABLED) or ! (wid_Title)) ; skip unimportant windows
Continue
WinGet, es, ExStyle, ahk_id %wid%
Parent := Decimal_to_Hex( DllCall( "GetParent", "uint", wid ) )
WinGetClass, Win_Class, ahk_id %wid%
WinGet, Style_parent, Style, ahk_id %Parent%
If ((excludeToolWindows & (es & WS_EX_TOOLWINDOW))
or ((es & ws_ex_controlparent) and ! (Style & WS_POPUP) and !(Win_Class ="#32770") and ! (es & WS_EX_APPWINDOW)) ; pspad child window excluded
or ((Style & WS_POPUP) and (Parent) and ((Style_parent & WS_DISABLED) =0))) ; notepad find window excluded ; note - some windows result in blank value so must test for zero instead of using NOT operator!
continue
AltTab_ID_List_ ++
AltTab_ID_List_%AltTab_ID_List_% :=wid
}
AltTab_ID_List_0 := AltTab_ID_List_
}
Oops; our edits got crossed up. I tried to put Humpty Dumpty back together again; please check that your code is what you meant it to be. – Scott – 2019-02-17T16:57:38.107
0
Using Autohotkey, here's my version, which works with Chrome and Electron apps. It was modified from @user332861's answer, so that it correctly distinguishes between Chrome and Electron apps such as Slack and Visual Studio Code. (To do that, it uses ahk_exe
instead of ahk_class
)
!`:: ; Next window if using alt-backtick
WinGet, ExeName, ProcessName , A
WinGet, ExeCount, Count, ahk_exe %ExeName%
If ExeCount = 1
Return
Else
WinSet, Bottom,, A
WinActivate, ahk_exe %ExeName%
return
!+`:: ; prev window, Alt+shift+backtick
WinGet, ExeName, ProcessName , A
WinActivateBottom, ahk_exe %ExeName%
return
0
!`::
#`::
WinGet, ExeName, ProcessName, A
WinActivateBottom, ahk_exe %ExeName%
return
Simplified from @otter.pro's answer. This simply cycles backwards through the current application windows. Cycling forwards can cause brief flashes of other windows to appear. Since not seeing flashes is probably more important than bidirectional cycling, just don't cycle forwards. Furthermore, this answer allows #` as an alternative to !` since that's the key combination for the Mac shortcut.
0
Ctrl + Win + [Number] (Tested on Windows 10)
This is the closest built-in solution I managed to figure out.
Difference compared to the other answers:
When Win + [Number] is used without Ctrl, it always start from the first window, which is annoying/not what I really want most of the time.
No 3rd party software needed.
No mouse click needed.
1
Related (but for Linux): Linux Mint – switch between windows of the same application.
– Scott – 2017-09-23T04:16:54.363<rant>I wish Redmond would focus on UX and add more Windows key shortcuts, like for this question. They give us 99% of stuff we don't want but don't just make our lives easier by making Windows easier to use. I guess it would take a junior programmer all of two hours to add a new shortcut for this.</rant> – Pete Alvin – 2018-05-15T14:04:46.393