yqrashawn / GokuRakuJoudo

config karabiner with ease
GNU General Public License v3.0
1.17k stars 120 forks source link

How to implement dead keys like in workman dead key layout do? #212

Open sokinpui opened 1 year ago

sokinpui commented 1 year ago

The idea of using 'dead' keys is based on assumption that pressing 2 easy keys is better than pressing hard key. So to make it easier to type (programming) characters/symbols, we're going to press an easily reachable key (which will NOT output any character), release it and then press another easily reachable key to produce, say, @ character.

I try to implement this in goku, since I use qwerty layout, while I find my code bug, after I press period, I cannot exit the dead-mode anymore, also, the period is displayed on the screen before I press another key. The following code try to implement that: tap period key . to enter dead-mode, then type d to display (.

{:des "dead key mode"
  :rules [
    [:period [["dead-mode" 0]] ["dead-mode" 1]]
    [:d
        [["dead-mode" 1] :!S9]
        ["dead-mode" 0]
        {:delayed {:invoked ["dead-mode" 0] :canceled ["dead-mode" 0]} :params {:delay 300}}]
    ]}

What should I improve to implement dead key?