AutoHotKey: remapping Alt+Shift+Tab to (L)Win+Shift+Tab

I'm trying to use AutoHotKey to get Alt+Tab and Shift+Alt+Tab in Windows to have the same behavior as Cmd+Tab and Shift+Cmd+Tab in macOS.

Note: Cmd on a mac keyboard sends the Win key.

What I've gotten to work is:

LWin & Tab:: AltTab

What I haven't been able to do is get LWin+Shift+Tab to send Shift+Alt+Tab. I've tried:

  1. #Shift & Tab:: ShiftAltTab (error: must specify L or R for # in this case)
  2. LWin & Shift & Tab :: ShiftAltTab (Can't use 3 custom combinations)
  3.  

    Lwin & Tab::
           if GetKeyState("Shift")
               {
               Send {ShiftAltTab}
               }
           else
               {
               Send {AltTab}
               }
    

I also tried with return lines after each Send line. Nothing happened when pressing either

  • LCmd+Tab (== LWin+Tab) or
  • LCmd+Shift+Tab (== LWin+Shift+Tab).

Is there a quick and simple way to do this? I want to use AHK since it is modifying the combinations to mimic a lot of other Mac keyboard behaviors.


Solution 1:

LWin & Tab:: 
    AltTabMenu := true
    If GetKeyState("Shift","P")
        Send {Alt Down}{Shift Down}{Tab}
    else
        Send {Alt Down}{Tab}
return

#If (AltTabMenu)

    ~*LWin Up::
        Send {Shift Up}{Alt Up}
        AltTabMenu := false 
    return

#If

Tested on Windows 10.