Skip to content

Instantly share code, notes, and snippets.

@alexmorozov
Created November 17, 2015 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexmorozov/48e8bf90fa85cab909c8 to your computer and use it in GitHub Desktop.
Save alexmorozov/48e8bf90fa85cab909c8 to your computer and use it in GitHub Desktop.
Bind windows to hotkeys
; Map windows to 1-0 with ctrl+win+<num>, switch with alt+<num>
Loop 10
{
i := A_Index - 1
HotKey #^%i%,DynHotkey
HotKey !%i%, DynHotkey
}
Exit
DynHotkey:
StringRight i, A_ThisHotKey, 1
StringMid what,A_ThisHotKey, 2, 1
var := var%i%
IfEqual what, ^, WinGet var%i%, ID, A ; Save ID
WinActivate ahk_id %var% ; Switch
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment