Skip to content

Instantly share code, notes, and snippets.

@arnoson
Last active May 19, 2025 20:25
Show Gist options
  • Save arnoson/4a5c8240bd531aa9c7891fc7590920b4 to your computer and use it in GitHub Desktop.
Save arnoson/4a5c8240bd531aa9c7891fc7590920b4 to your computer and use it in GitHub Desktop.
Simple AutoHotKey v2 Extend Layer
; Extend Layer
; Based on https://dreymar.colemak.org/layers-extend.html
; Note: I experimented with a lot of different implementations for caps lock as
; an extend key using `GetKeyState("CapsLock", "P")`. All of them broke when
; typing really fast. In the end this reddit post (https://www.reddit.com/r/AutoHotkey/comments/1fox8q1/typing_too_fast_breaks_my_script/)
; solved it by not relying on `GetKeyState` but instead using direct key
; combinations.
#Requires AutoHotkey v2+
#SingleInstance Force
SendMode('Event')
SetCapsLockState("AlwaysOff")
; Modifiers
CapsLock & a::Alt
CapsLock & d::Shift
CapsLock & f::Ctrl
; Commands
CapsLock & f::Ctrl
CapsLock & z::^z
CapsLock & x::^x
CapsLock & c::^c
CapsLock & v::^v
; Arrows
CapsLock & i::Up
CapsLock & k::Down
CapsLock & j::Left
CapsLock & l::Right
; Navigation
CapsLock & w::WheelUp
CapsLock & s::WheelDown
CapsLock & u::Home
CapsLock & o::End
CapsLock & y::PgUp
CapsLock & h::PgDn
; Misc
CapsLock & q::Esc
CapsLock & `;::BackSpace
CapsLock & '::AppsKey
CapsLock & Space::^Space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment