28

I am looking for a way to switch between two open windows of the same app with a key shortcut, I have found this https://neosmart.net/EasySwitch/ but it is not open source and I don't trust it even works. Does anyone has an alternative ? This is OOTB in Unity and Mac OS it is absurd that Windows doesn't have it.

Some time ago a Microsoft employee made this tool : https://switcher.en.softonic.com/ not sure what is the official website, it is GREAT but works only on Windows 7 and doesnt work on 10, also not open source.

The closest thing I have found that is open source is this one https://github.com/JochenBaier/fastwindowswitcher but is less then ideal.

is there an alternative ?

4

4 Answers 4

27
+50

You may implement the Alt+` shortcut yourself using the free AutoHotkey.

The following script will cycle through all the windows of the active process:

!`::
WinGetClass, OldClass, A
WinGet, ActiveProcessName, ProcessName, A
WinGet, WinClassCount, Count, ahk_exe %ActiveProcessName%
IF WinClassCount = 1
    Return
loop, 2 {
  WinSet, Bottom,, A
  WinActivate, ahk_exe %ActiveProcessName%
  WinGetClass, NewClass, A
  if (OldClass <> "CabinetWClass" or NewClass = "CabinetWClass")
    break
}

After installing AutoHotKey, put the above text in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at
C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

Useful AutoHotkey documentation:

3
  • 1
    If you want, you could even compile the file by right clicking on it and remove AHK. May 16, 2022 at 11:42
  • Copy paste the script didnt work to me. Changed the first line to `!'::`` works Oct 18, 2022 at 23:28
  • Is it possible to show a preview of windows, just like alt+tab?
    – Lutosław
    Dec 27, 2022 at 12:51
21

There are three ways for doing this:

  1. You can hold Ctrl + Click on the icon of the app in the taskbar
  2. Use Win + position of app on taskbar. For example, if Google Chrome is on third position, do Win+3 to switch between windows of Chrome. Note that this cycles through the different windows, so for opening 4th window you'll have to press 3 four times.
  3. The fastest of all, Using Win + ctrl + n does exactly what you want. (where n is position of the app on taskbar)

Note that in 2nd and 3rd options if n is specified such that no window of that program is already open, windows will open a new window. This effect can also be acheived by pressing Win + shift + n, regardless of if windows of that app were already open or not.

6
  • 2
    What if n is greater than 9 ?
    – Lucifer
    May 18, 2022 at 11:16
  • 1
    @Lucifer, make it lesser than 9 :P. Okay, sorry, there is no real way to do this but you can def rearrange taskbar programs May 18, 2022 at 11:31
  • 2
    This is a good option as does not need to install and add something to OS. Of course with the limitations as mentioned above.
    – jethar
    Aug 13, 2022 at 7:35
  • 1
    In my opinion this does not answer the OP well because you need to remember the order of windows in the taskbar and also I would assume that using the mouse is not an option here
    – elonderin
    Oct 20, 2022 at 4:21
  • 1
    3rd option is nice, thanks!
    – amordo
    Nov 14, 2022 at 11:47
1

I've modified ahk script in order to have an Ubuntu style switching. Pressing ` while holding an alt key will cycle through all application windows putting the next one on top rather than sending top window to the bottom. And single alt + ` combinations will cycle between last two windows.

!`::
WinGet, ActiveProcessName, ProcessName, A
WinGet, WinClassCount, List, ahk_exe %ActiveProcessName%

if (WinClassCount = 1)
    return

if (NextWindow = "")
    NextWindow := 2

element := % WinClassCount%NextWindow%

WinSet, Top,, ahk_id %element%
WinActivate, ahk_id %element%

NextWindow += 1

if (NextWindow > WinClassCount || !getKeyState("Alt"))
    NextWindow := 2

return
2
  • I gave this a try and it has some funny behavior...seems to switch between applications sometimes.
    – Guillochon
    Sep 28, 2022 at 16:54
  • It doesn't seem to work. Dec 23, 2022 at 20:29
0

I've implemented a script using AutoHotkey v2 which does what Ubuntu can do out of the box: switch between windows of the current app by pressing Alt+; (which is what the key in the top left corner types by default on my keyboard layout; you will probably want to adjust for yourself).
It counts with multiple presses so works even in cases there are multiple windows of the app, not just two. Feel free to use, PRs for improving welcome :-D

https://github.com/jendakol/autohotkey/blob/main/window-switch-multiple.ahk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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