Last active
May 21, 2024 10:05
-
-
Save pirey/79442f230d77d0e067677261101adc58 to your computer and use it in GitHub Desktop.
autohotkey script to remap capslock as both control and escape key.
This file contains 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
; Remap Caps Lock to Ctrl | |
Capslock::Ctrl | |
; Remap Ctrl + [ to Escape | |
^[:: | |
Send, {Escape} | |
return | |
; Remap Escape to Caps Lock | |
Escape::Capslock |
This file contains 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
; Change Caps Lock to Control when held down; otherwise, Escape | |
; | |
; Originally based on the answer provided in | |
; [this](https://superuser.com/questions/581692/remap-caps-lock-in-windows-escape-and-control) | |
; StackExchange SuperUser question. | |
; | |
; A shortcut should be created for this script and placed in the Windows 10 | |
; user's startup folder to automatically enable the feature on boot/startup. | |
; The user's startup folder can be found using the following steps: | |
; | |
; 1. Windows Key+R. The _Run_ dialog will appear. | |
; 2. Enter the following: `%appdata%\Microsoft\Windows\Start Menu\Programs\Startup` | |
; 3. Press Enter key. A file explorer dialog will appear. | |
; | |
; Obviously, [AutoHotkey](https://autohotkey.com/) must be installed for this to work. | |
*CapsLock:: | |
Send {Blind}{Ctrl Down} | |
cDown := A_TickCount | |
Return | |
*CapsLock up:: | |
; TODO: prevent send {Esc} after another key has been pressed. | |
If ((A_TickCount-cDown)<100) ; Modify press time as needed (milliseconds) | |
Send {Blind}{Ctrl Up}{Esc} | |
Else | |
Send {Blind}{Ctrl Up} | |
Return |
Not sure why but the script for ahk v1 is more consistent than v2 script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got the script from https://www.autohotkey.com/boards/viewtopic.php?p=468638&sid=c96c7e48529bc2061a4d6d76eb9616fb#p468638