Skip to content
@magnushammar
GitHubTwitter

Autohotkey keyboard remapping

Remap for programming on a Swedish keyboard.

  • CapsLock is now a modifier key instead of a useless I AM SCREAMING key
    • $ { [ ] } \ can now be accessed without being a contortionist (AltGr.. looking at you!)
    • I J K L is navigation arrows
    • H Ö is Home & End
    • U O is Delete & Backspace
    • Y is Escape
    • `(Grave accent) is not a Dead Key anymore.
    • I also added a couple of F#-ish keys | & |> & ->
    • Swapped SC01B (dead key) for ^ and with caps ~

I’m still considering if I should do something with > & *

hammar-keyremap.ahk

Task scheduler on login

  • Trigger: At log in
  • Action: Start a program ‘pathto\AutoHotkey.exe
  • Arguments: ‘/r “.\pathto\hammar-keyremap.ahk”

Code (duh…)

; *********** FOR SWEDISH KEYBOARD ***********

#SingleInstance, force
    
SetCapsLockState, AlwaysOff

; Regular remapping
RWin::AppsKey
§:: Send {esc}
;SC01B::^

; CapsLock Remapping
SC00D::Remap("\","{U+0060}")
SC01B::Remap("{U+005E}","{U+007E}")
*j:: Remap("j","{left}")
*+:: Remap("{+}", "\")
*i:: Remap("i","{up}")
*l:: Remap("l","{right}")
*k:: Remap("k","{down}")
*ö:: Remap("ö","{end}")
*h:: Remap("h","{home}")
*u:: Remap("u","{bs}")
*o:: Remap("o","{delete}")
*y:: Remap("y","{escape}")
*7:: Remap("7","{{}")
*8:: Remap("8","[")
*9:: Remap("9","]")
*0:: Remap("0","{}}")
*4:: Remap("4","$")
*n:: Remap("n","<")
*m:: Remap("m","/")
*,:: Remap(",","|")
*.:: Remap(".",">")
*2:: Remap("2","@")


CapsLockDown()
{
    return GetKeyState("CapsLock", "P")
}

Remap(original,new)
{
    if CapsLockDown() 
    {
        Send, {Blind}%new%
    }
    else
    {
        Send, {Blind}%original%
    }
}