Skip to content

Instantly share code, notes, and snippets.

@icorbrey
Created November 11, 2024 17:25
Show Gist options
  • Save icorbrey/6636adde77bcf21036296fb793c0b3fd to your computer and use it in GitHub Desktop.
Save icorbrey/6636adde77bcf21036296fb793c0b3fd to your computer and use it in GitHub Desktop.
; # Home Row Mods
;
; See: <https://precondition.github.io/home-row-mods>
;
; ## Layout
;
; This script uses the GASC ordering, or GUI - Alt - Ctrl - Shift.
;
; Key: Mod/Tap
;
; CAPS A S D F G H J K L ;
; Ctrl/Esc GUI/A Alt/S Ctrl/D Shift/F G H Shift/J Ctrl/K Alt/L GUI/;
;
; This is a
#Include Lib/TapHoldManager.ahk
#SingleInstance Force
thm := TapHoldManager(100, 100)
thm.Add("CapsLock", HandleCapsLock)
thm.Add("a", HandleA)
thm.Add("s", HandleS)
thm.Add("d", HandleD)
thm.Add("f", HandleF)
thm.Add("j", HandleJ)
thm.Add("k", HandleK)
thm.Add("l", HandleL)
thm.Add(";", HandleSemicolon)
ModTap(isHeld, state, modifier, tap) {
event := isHeld ? state = 0 ? "mod-up" : "mod-down" : "tap"
switch event {
case "mod-down":
Send "{" modifier " down}"
case "mod-up":
Send "{" modifier " up}"
case "tap":
Send "{" tap "}"
}
}
HandleCapsLock(isHeld, _taps, state) {
ModTap(isHeld, state, "Ctrl", "Escape")
}
HandleA(isHeld, _taps, state) {
ModTap(isHeld, state, "LWin", "a")
}
HandleS(isHeld, _taps, state) {
ModTap(isHeld, state, "Alt", "s")
}
HandleD(isHeld, _taps, state) {
ModTap(isHeld, state, "Ctrl", "d")
}
HandleF(isHeld, _taps, state) {
ModTap(isHeld, state, "Shift", "f")
}
HandleJ(isHeld, _taps, state) {
ModTap(isHeld, state, "Shift", "j")
}
HandleK(isHeld, _taps, state) {
ModTap(isHeld, state, "Ctrl", "k")
}
HandleL(isHeld, _taps, state) {
ModTap(isHeld, state, "Alt", "l")
}
HandleSemicolon(isHeld, _taps, state) {
ModTap(isHeld, state, "LWin", ";")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment