Skip to content

Instantly share code, notes, and snippets.

@demicuz
Last active January 1, 2019 01:42
Show Gist options
  • Save demicuz/6cd5e76b271c3f8abd2b0df4b69552e1 to your computer and use it in GitHub Desktop.
Save demicuz/6cd5e76b271c3f8abd2b0df4b69552e1 to your computer and use it in GitHub Desktop.
Colemak mod-DH with QWERTY hot keys and support for painless keyboard language switching
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
; SendMode Input ; Uncomment if keys start to glitch
; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Colemak Mod-DH mapping for ANSI boards
; Note - shift is pressed first
Shift & LAlt::
Suspend
PostMessage WM_INPUTLANGCHANGEREQUEST:=0x50, INPUTLANGCHANGE_FORWARD:=0x2,,, % (hWndOwn := DllCall("GetWindow", Ptr, hWnd:=WinExist("A"), UInt, GW_OWNER := 4, Ptr)) ? "ahk_id" hWndOwn : "ahk_id" hWnd
return
e::f
r::p
t::b
y::j
u::l
i::u
o::y
p::;
s::r
d::s
f::t
h::k
j::n
k::e
l::i
`;::o
z::x
x::c
c::d
b::z
n::m
m::h
; Set CTRL
^e::^e
^r::^r
^t::^t
^y::^y
^u::^u
^i::^i
^o::^o
^p::^p
^s::^s
^d::^d
^f::^f
^h::^h
^j::^j
^k::^k
^l::^l
^;::^;
^z::^z
^x::^x
^c::^c
^b::^b
^n::^n
^m::^m
; Set ALT
!e::!e
!r::!r
!t::!t
!y::!y
!u::!u
!i::!i
!o::!o
!p::!p
!s::!s
!d::!d
!f::!f
!h::!h
!j::!j
!k::!k
!l::!l
!;::!;
!z::!z
!x::!x
!c::!c
!b::!b
!n::!n
!m::!m
; Set WIN
#e::#e
#r::#r
#t::#t
#y::#y
#u::#u
#i::#i
#o::#o
#p::#p
#s::#s
#d::#d
#f::#f
#h::#h
#j::#j
#k::#k
#l::#l
#;::#;
#z::#z
#x::#x
#c::#c
#b::#b
#n::#n
#m::#m
; Set CTRL + SHIFT
^+e::^+e
^+r::^+r
^+t::^+t
^+y::^+y
^+u::^+u
^+i::^+i
^+o::^+o
^+p::^+p
^+s::^+s
^+d::^+d
^+f::^+f
^+h::^+h
^+j::^+j
^+k::^+k
^+l::^+l
^+;::^+;
^+z::^+z
^+x::^+x
^+c::^+c
^+b::^+b
^+n::^+n
^+m::^+m
; Set CTRL + ALT
^!e::^!e
^!r::^!r
^!t::^!t
^!y::^!y
^!u::^!u
^!i::^!i
^!o::^!o
^!p::^!p
^!s::^!s
^!d::^!d
^!f::^!f
^!h::^!h
^!j::^!j
^!k::^!k
^!l::^!l
^!;::^!;
^!z::^!z
^!x::^!x
^!c::^!c
^!b::^!b
^!n::^!n
^!m::^!m
; Set SHIFT + ALT
+!e::+!e
+!r::+!r
+!t::+!t
+!y::+!y
+!u::+!u
+!i::+!i
+!o::+!o
+!p::+!p
+!s::+!s
+!d::+!d
+!f::+!f
+!h::+!h
+!j::+!j
+!k::+!k
+!l::+!l
+!;::+!;
+!z::+!z
+!x::+!x
+!c::+!c
+!b::+!b
+!n::+!n
+!m::+!m
; Set CTRL + SHIFT + ALT
^+!e::^+!e
^+!r::^+!r
^+!t::^+!t
^+!y::^+!y
^+!u::^+!u
^+!i::^+!i
^+!o::^+!o
^+!p::^+!p
^+!s::^+!s
^+!d::^+!d
^+!f::^+!f
^+!h::^+!h
^+!j::^+!j
^+!k::^+!k
^+!l::^+!l
^+!;::^+!;
^+!z::^+!z
^+!x::^+!x
^+!c::^+!c
^+!b::^+!b
^+!n::^+!n
^+!m::^+!m
; set Backspace to CapsLock key
; sc03a::backspace
@demicuz
Copy link
Author

demicuz commented Jan 21, 2018

The problem with the first version is when you suspend the hot keys (to specifically type in QWERTY), and accidentally press Ctrl/Alt/Win, Colemak comes in play again, but not for all keys, which is weird. I've tried various approaches, none of them worked for me (because I'm a noob in AHK). So I just hard-coded it :)

@demicuz
Copy link
Author

demicuz commented Jan 1, 2019

Shift + LAlt for language switching. Works only with two languages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment