Created
April 28, 2026 08:02
-
-
Save Benjaminlooi/df5326c7c37e54aa285173243fb9152e to your computer and use it in GitHub Desktop.
AutoHotkey v2 script to Remap Caps Lock to a Hyper key (Ctrl+Alt+Shift+Win) on hold, Escape on tap, and preserves actual Caps Lock via Shift+Caps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Requires AutoHotkey v2.0 | |
| ; *CapsLock:: | |
| ; { | |
| ; startTime := A_TickCount | |
| ; Send("{Ctrl down}{Shift down}{Alt down}{LWin down}") | |
| ; KeyWait("CapsLock") | |
| ; Send("{Ctrl up}{Shift up}{Alt up}{LWin up}") | |
| ; if (A_TickCount - startTime < 200) && (A_PriorKey = "CapsLock") | |
| ; { | |
| ; SetCapsLockState(!GetKeyState("CapsLock", "T")) | |
| ; } | |
| ; } | |
| ; 1. Shift + Caps Lock = Toggle actual Caps Lock | |
| +CapsLock:: { | |
| SetCapsLockState !GetKeyState("CapsLock", "T") | |
| } | |
| ; 2. Caps Lock = Hyper (Hold) or Escape (Tap) | |
| *CapsLock:: { | |
| ; Press down the Hyper modifiers | |
| Send "{LCtrl down}{LAlt down}{LShift down}{LWin down}" | |
| ; Wait for Caps Lock to be released | |
| KeyWait "CapsLock" | |
| ; Release the Hyper modifiers | |
| Send "{LWin up}{LShift up}{LAlt up}{LCtrl up}" | |
| ; If no other key was pressed while Caps Lock was held down, fire Escape. | |
| ; (This inherently handles the tap behavior without needing a strict 500ms timer, | |
| ; but acts identically to your Karabiner setup). | |
| if (A_PriorKey = "CapsLock") { | |
| Send "{Esc}" | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Windows AutoHotkey v2 script to replicate standard Karabiner-Elements developer keybinds: