Skip to content

Instantly share code, notes, and snippets.

@anderssonjohan
Last active November 1, 2021 23:32
Show Gist options
  • Save anderssonjohan/e4249e878bdd9ee568571d6445701f9c to your computer and use it in GitHub Desktop.
Save anderssonjohan/e4249e878bdd9ee568571d6445701f9c to your computer and use it in GitHub Desktop.

Revisions

  1. anderssonjohan revised this gist Nov 1, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions svorak.ahk
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,9 @@
    SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

    ; Keys on dell laptop: LCtrl, Fn, LWin, LAlt
    ; Result: LWin, Fn, LAlt, LCtrl
    ; ..to get Ctrl next to spacebar so most Cmd key bindings are where the mac user muscle memory says they should be :)
    LWin::LAlt
    LAlt::LCtrl
    LCtrl::LWin
  2. anderssonjohan revised this gist Nov 1, 2021. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions svorak.ahk
    Original file line number Diff line number Diff line change
    @@ -9,12 +9,12 @@ LCtrl::LWin
    RWin::RAlt
    RAlt::RWin

    !':: Send, å
    !,:: Send, ä
    !.:: Send, ö
    !+':: Send, Å
    !+,:: Send, Ä
    !+.:: Send, Ö
    !':: Send, å ; Alt-Q
    !,:: Send, ä ; Alt-W
    !.:: Send, ö ; Alt-E
    !+':: Send, Å ; Alt-Shift-Q
    !+,:: Send, Ä ; Alt-Shift-W
    !+.:: Send, Ö ; Alt-Shift-E


    ; This reverts the Alt+Tab behavior
  3. anderssonjohan created this gist Nov 1, 2021.
    98 changes: 98 additions & 0 deletions svorak.ahk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,98 @@
    #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn ; Enable warnings to assist with detecting common errors.
    SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

    LWin::LAlt
    LAlt::LCtrl
    LCtrl::LWin
    RWin::RAlt
    RAlt::RWin

    !':: Send, å
    !,:: Send, ä
    !.:: Send, ö
    !+':: Send, Å
    !+,:: Send, Ä
    !+.:: Send, Ö


    ; This reverts the Alt+Tab behavior
    ^Tab::
    Send, {LAlt Down}{Tab}
    ReleaseLAlt(10000)

    ; The purpose of this function is to release the LAlt key
    ; Without this, the LAlt key will be stuck
    ReleaseLAlt(timeout := "")
    {
    startTime := A_Tickcount

    while (isaKeyPhysicallyDown("LAlt"))
    {
    if (timeout && A_Tickcount - startTime >= timeout)
    Send, {LAlt Up} ; Took too long

    sleep, 50
    }

    Send, {LAlt Up}
    }

    isaKeyPhysicallyDown(Keys)
    {
    if isobject(Keys)
    {
    for Index, Key in Keys
    if getkeystate(Key, "P")
    return key
    }
    else if getkeystate(Keys, "P")
    return Keys ;keys!
    return 0
    }

    ![::Send !{Left}
    !]::Send !{Right}
    !a::Send ^a
    !b::Send ^b
    !c::Send ^c
    !d::Send ^d
    !e::Send ^e
    !f::Send ^f
    !g::Send ^g
    !h::Send ^h
    !i::Send ^i
    !j::Send ^j
    !k::Send ^k
    !l::Send ^l
    !m::Send ^m
    !n::Send ^n
    !o::Send ^o
    !p::Send ^p
    !q::Send ^q
    !r::Send ^r
    !s::Send ^s
    !t::Send ^t
    !u::Send ^u
    !v::Send ^v
    !w::Send ^w
    !x::Send ^x
    !y::Send ^y
    !z::Send ^z

    !Right::
    Send {End}
    return

    *!Right:: ; This handles Shift-Right
    Send {Blind}{LAlt Up}{End}
    return

    !Left::
    Send {Home}
    return

    *!Left:: ; This handles Shift-Left
    Send {Blind}{Alt Up}{Home}
    return