OneDeadKey / kalamine

Keyboard Layout Maker
MIT License
105 stars 29 forks source link

[macOS] unexpected Shift behavior when the `1dk` layer contains dead keys #43

Closed robinmoussu closed 8 months ago

robinmoussu commented 8 months ago

I’m listing here all the issue that i found so far when trying to generate the bmp disposition which seems to be a good stress test !

I’m using kalamine 0.18, from the latest master.

(note: github doesn’t like .yaml and .keylayout files, so I added the suffix .txt, like in the early 00’ :yeah:)

bmp.keylayout.actual.txt bmp.keylayout.expected.txt bmp.yaml.txt

By order of apparition of the issue in the file:

(note: I’ve noticed that my expected file, while totally functional as-it (it’s the one I’m using currently) as a few defect, like using "http" instead of "https" in the reference link, or a few unneeded things related to the modifier map index, so kalamine is not expected to generate a bit perfect copy of bmp.keylayout.expected)

fabi1cazenave commented 8 months ago

I’m not sure whether I should pick this issue or not. Maybe you’re already working on it @robinmoussu ?

As per the task list, I suggest to move out of this issue all items that are not specific to macOS :

fabi1cazenave commented 8 months ago

FTR, your YAML altgr layer specification is incorrect.

You wrote this:

altgr: |
  ╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
  ┆     ┃ 1   │ 2   │ 3   │ 4   │ 5   ┃ 6   │ 7   │ 8   │ 9   │ 0   ┃     ┆     ┆
  ┆     ┃ 1   │ 2   │ 3   │ 4   │ 5   ┃ 6   │ 7   │ 8   │ 9   │ 0   ┃     ┆     ┆
  ╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃ pgup│ret  │ up  │ del │ pgd ┃     │ 7   │ 8   │ 9   │     ┃     ┆     ┆
  ·     ┃ @   │ [ « │ ] » │ $ € │ % ‰ ┃ ^   │ &   │ "   │ '   │ `   ┃     ┆     ┆
  ·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃ org │ left│down │right│ end ┃     │ 4   │ 5   │ 6   │     ┃     ┆     ┆
  ·     ┃ {   │ (   │ )   │ }   │ _   ┃ |   │ + ± │ - − │ * × │ ! ¬ ┃     ┆     ┆
  ╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
  ┆     ┃     │ tab │     │enter│     ┃     │ 1   │ 2   │ 3   │     ┃           ·
  ┆     ┃ ~ „ │ < “ │ > ” │ = ≠ │ # ° ┃ \   │ / ÷ │ ;   │ :   │ ?   ┃           ·
  ╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·

But kalamine expects symbols to be defined in the lower-right corner, like this:

altgr: |
  ╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
  ┆     ┃     │     │     │     │     ┃     │     │     │     │     ┃     ┆     ┆
  ┆     ┃     │     │     │     │     ┃     │     │     │     │     ┃     ┆     ┆
  ╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃     │     │     │     │     ┃     │   7 │   8 │   9 │     ┃     ┆     ┆
  ·     ┃   @ │   [ │   ] │   $ │   % ┃   ^ │   & │   " │   ' │   ` ┃     ┆     ┆
  ·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃     │     │     │     │     ┃     │   4 │   5 │   6 │     ┃     ┆     ┆
  ·     ┃   { │   ( │   ) │   } │   _ ┃   | │   + │   - │   * │   ! ┃     ┆     ┆
  ╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
  ┆     ┃     │     │     │     │     ┃     │   1 │   2 │   3 │     ┃           ·
  ┆     ┃   ~ │   < │   > │   = │   # ┃   \ │   / │   ; │   : │   ? ┃           ·
  ╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·

The Lafayette and Ergo-L projects should be good templates for such YAML/TOML descriptors, where both the 1dk and altgr layers are wanted. And as they’re only using what Kalamine supports, they would be much better test files to improve the macOS support.

Please consider generating one of these two layouts and fixing the resulting *.keylayout file to help me fix these macOS-specific issues.

fabi1cazenave commented 8 months ago

In fact, before considering that a bug is macOS-specific, it would be very helpful to start testing your YAML/TOML layout descrptor with kalamine --watch. In your case:

kalamine --watch bmp.yaml

I can see using kalamine --watch that no altgr layer has been defined, which explains why there’s no ASCII art for it in the *.keylayout file. Which means it is not a macOS issue.

[EDIT] And using a proper altgr description, e.g. taking the one from the Ergo-L project, works fine and does produce a valid ASCII art in the *.keylayout file. [/EDIT]

However, Shift+. and Shift+, do produce : and ;, in the *.keylayout file though it works as expected in kalamine --watch, so we do have a macOS-specific issue here.

fabi1cazenave commented 8 months ago

So… after a few tests, I think the only macOS-specific issue we have here is related to the Shift layer, which is sometimes incorrect. In your example :

I think all other items are either related to unsupported features or to mistakes in your YAML file. Do you agree ?

fabi1cazenave commented 8 months ago

I’ve just realized that these wrong behaviors for the Shift layer are related to the dead keys in the 1dk layer. In other words, without dead keys in the 1dk layer (which is not supported at the moment but happens to work on Linux), everything works fine.

fabi1cazenave commented 8 months ago

Help wanted, as I still don’t have any Mac. Seeing some improvement supporting dead keys in the 1dk layer would be nice to have, as we’re considering it for a very specific use case in Lafayette42 and Ergo-L.

fabi1cazenave commented 8 months ago

I see new issues related to #55 keep being created, so closing all of them as duplicates now.