Skip to content

Instantly share code, notes, and snippets.

@gpadd
Created March 7, 2024 10:25
Show Gist options
  • Save gpadd/d7bf280c31410df1ef8b6412f3db0d5a to your computer and use it in GitHub Desktop.
Save gpadd/d7bf280c31410df1ef8b6412f3db0d5a to your computer and use it in GitHub Desktop.
Remap CAPS to be either CTRL or ESC depending on if you are holding it down or not. Tweaked For AutoHotkey v2. Original from https://superuser.com/a/581988
#Requires AutoHotkey v2.0
*CapsLock::
{
Send "{Blind}{Ctrl Down}"
global cDown := A_TickCount
}
*CapsLock up::
{
; Modify the threshold time (in milliseconds) as necessary
If ((A_TickCount-cDown) < 150)
Send "{Blind}{Ctrl Up}{Esc}"
Else
Send "{Blind}{Ctrl Up}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment