Half-QWERTY keyboard
Allows you to code (or do other things) one-handed, using a normal keyboard. While the spacebar is pressed, each half of the keyboard
is mirrored to the other.
Code:
#SingleInstance force
#InstallKeybdHook ; otherwise space-up tends to get dropped
; ==== keyboard configuration ====
Pair("1", "0")
Pair("2", "9")
Pair("3", "8")
Pair("4", "7")
Pair("5", "6")
Pair("q", "p")
Pair("w", "o")
Pair("e", "i")
Pair("r", "u")
Pair("t", "y")
Pair("a", semicolon := "SC27")
Pair("s", "l")
Pair("d", "k")
Pair("f", "j")
Pair("g", "h")
Pair("z", slash := "SC35")
Pair("x", period := "SC34")
Pair("c", comma := "SC33")
Pair("v", "m")
Pair("b", "n")
Pair("tab", "backspace")
Pair(dash := "SC0C", backtick := "SC29")
OneWay("capslock", "enter") ; special case... unmirrored=enter, mirrored=quote
Hotkey,*capslock, on
Hotkey,*capslock up, on
Pair(x, y)
{
OneWay(x, y)
OneWay(y, x)
}
; remap `from` to `to` (but only when space is depressed)
OneWay(from, to)
{
global ; (apparently `global remap_%from%` is still invalid syntax...)
Hotkey, *%from%, remap_down, off
Hotkey, *%from% up, remap_up, off
;ToolTip, %from%, 0, 0 ; uncomment to find out what has to be converted to "SCnn" syntax
remap_%from% := to
if (remap_list != "")
remap_list := remap_list . "`n"
remap_list := remap_list . from
}
space::
Loop, parse, remap_list, `n
{
Hotkey, *%A_LoopField%, on
Hotkey, *%A_LoopField% up, on
}
remap_capslock := "'"
hotkeys_mirrored := 0
return
space up::
Loop, parse, remap_list, `n
{
Hotkey, *%A_LoopField%, off
Hotkey, *%A_LoopField% up, off
}
Hotkey,*capslock, on
Hotkey,*capslock up, on
remap_capslock := "enter"
if (hotkeys_mirrored == 0)
SendPlay,{space}
return
remap_down:
remap_from := SubStr(A_ThisHotKey, 2)
remap_to := remap_%remap_from%
; the exact equivalent of remapping, see http://www.autohotkey.com/docs/misc/Remap.htm#SendPlay
SetKeyDelay -1
Send {Blind}{%remap_to% DownTemp}
hotkeys_mirrored := hotkeys_mirrored + 1
return
remap_up:
remap_from := SubStr(A_ThisHotKey, 2, -3) ; "*enter up" => "enter"
remap_to := remap_%remap_from%
; the exact equivalent of remapping, see http://www.autohotkey.com/docs/misc/Remap.htm#SendPlay
SetKeyDelay -1
Send {Blind}{%remap_to% Up}
return