39aldo39/klfc

Chaining dead keys

wismill opened this issue · 1 comments

Hello, I would like to use chained dead keys, but I do not manage to make it work. Is it supported?
For example, in the following simplified example I would like to obtain:

  • ~ + u : ú
  • ~ + ~ + u: ű

It does not work with AHK.

{
  "shiftlevels": [ "None", "Shift" ],
  "keys": [
    { "pos": "~", "letters": [ "cdk:test1" ] }
  ],
  "customDeadKeys": [
    {
      "name": "test1",
      "stringMap": [
        [ "cdk:test1", "cdk:test2" ],
        [ "u", "ú"]
      ]
    },
    {
      "name": "test2",
      "stringMap": [
        [ "u", "ű" ]
      ]
    }
  ]
}

Chained dead keys such as your example are supported. However, you have to specify them a bit differently. I should add an example of it in the documentation.

You have two ways of specifying the dead key you want. One way is to use the 'nested dead key' feature of AHK (and PKL).

{
  "name": "test1",
  "stringMap": [
    [ "u", "ú" ],
    [ "ú", "ű" ]
  ]
}

This example works since dead keys can nest:

test1 + test1 + u → test1 + (test1 + u) → test1 + ú → ű

This is also very useful in combination with other dead keys, since the 'ú' can also be the result of a different dead key.

Another way is to, as you did, use dead keys in dead keys. However, currently your "cdk:test1" and "cdk:test2" are interpreted as strings. If you press 'test1', followed by the letters "cdk:test1" you get the string "cdk:test2". If you don't want strings, you have to give a list of letters. I have added support for dead keys in these lists.

Also, you don't have to create additional dead keys, KLFC does that for you! This means that your example simply becomes

{
  "name": "test2",
  "stringMap": [
    [ "u", "ú" ],
    [ ["cdk:test2","u"], "ű" ]
  ]
}

There were also a few bugs in the AHK implementation, which didn't allow a dead key to combine with itself. This should be fixed now.