DEV Community

Martin Kordas
Martin Kordas

Posted on

Speed up switching between opened windows using Autohotkey shortcuts

Usually our OS runs quite many application at one time and it could be quite hard not to get lost in so many opened windows. If you are using Windows, you usually have several built-in possibilities how to switch between open apps.

  1. Select an app from taskbar.
  2. Use Alt+Tab or Win+Tab shortcut to switch the app. (Least recently used apps are displayed first, which helps your orientation. You can also use arrow keys to navigate between suggested apps and Delete to close an app.)
  3. Use Win+<n> shortcut to open an app, whose icon is the nth icon on the taskbar. (You usually have several apps pinned to the taskbar, so their position is unchanging and therefore you remember their hotkey. For example, if you have web browser pinned as a first app on your taskbar, you regularly use Win+1 shortcut to open browser window. If the app doesn't run at all, OS will run it.)

Using Win+<n> shortcut saves me much time as I don't have to search between opened windows, I just use one exact hotkey instead and the window gets displayed. The problem is that it is possible to use this hotkey only for 10 apps (corresponding to 0-9 keys on your keyboard).

For this reason I installed Autohotkey program and created a simple script which shows an app based on its window title text. I always use Win+Shift+? shortcut (# means Win, + means Shift in Autohotkey scripts). With the script running, Visual Studio window shows up upon pressing Win+Shift+V, Postman shows up upon pressing Win+Shift+P and so on.

SetTitleMatchMode, Regex
SetTitleMatchMode, Slow

#+v::
WinActivate, .*Visual Studio
return 

#+p::
WinActivate, Postman
return

#+o::
WinActivate, .*LibreOffice
return

#+c::
WinActivate, .*Calc
return
Enter fullscreen mode Exit fullscreen mode

If you save the script with .ahk extension you can run it manually by double clicking it. Alternatively you can place it into your startup folder (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup) so as it will run automatically every time you use your computer.

Now you can switch to almost every running app so fast with just one keyboard shortcut.

You can do many other useful things with Autohotkey, like remapping keys you lack on your current physical keyboard or creating shortcuts for multimedia features (start/resume playing, volume up/down...), all of this achieved with standard keyboard layout without the need to buy specialized keyboard with additional keys.

Top comments (0)