kalamine icon indicating copy to clipboard operation
kalamine copied to clipboard

Add support for arrow keys in TOML layout descriptors

Open lobre opened this issue 1 year ago • 5 comments

Hello,

I would like to define directional arrow keys in my keymap on the altgr layer.

See the example:

altgr: |
  ╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
  ┆     ┃     │     │     │     │     ┃     │     │     │     │     ┃     ┆     ┆
  ┆     ┃     │     │     │     │     ┃     │     │     │     │     ┃     ┆     ┆
  ╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃     │     │     │     │     ┃     │     │     │     │     ┃     ┆     ┆
  ·     ┃     │     │   ↑ │     │     ┃     │     │     │     │     ┃     ┆     ┆
  ·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃   ⁽ │     │     │     │   ⁾ ┃     │     │     │     │   ± ┃     ┆     ┆
  ·     ┃   ( │   ← │   ↓ │   → │   ) ┃     │     │     │     │   + ┃     ┆     ┆
  ╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
  ┆     ┃     │     │   ¦ │     │     ┃     │     │     │     │   ≠ ┃           ·
  ┆     ┃   [ │   ] │   | │   { │   } ┃   \ │     │     │     │   = ┃           ·
  ╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·

I tried using the Unicode arrow keys, but they are not transformed by kalamine, so when pressing the key, those characters are literally printed.

However, if I modify the .xkb manually and transform uparrow into Up, it does the trick and it correctly references the arrow key.

Is it a feature that is missing in kalamine? Is there a way to tell that I want the actual directional arrow key from within my yaml file?

Thanks

lobre avatar Jul 20 '23 13:07 lobre

Hello,

it would be nice to have also the top, bottom, page up and down keys.

aneth-dev avatar Oct 31 '23 09:10 aneth-dev

Honestly, that really sounds like a job for kanata to me. But having some kind of support for Neo-like layouts would be neat, indeed.

fabi1cazenave avatar Dec 23 '23 23:12 fabi1cazenave

I’m reconsidering this. Kalamine should allow to do whatever is possible on the all three target platforms (windows, macOS, linux), and this is certainly doable.

Maybe we could use \ escape codes for that:

  • \h \j \k \l or \← \↓ \↑ \→ for the arrow keys
  • \H \J \K \L or \⇱ \⇟ \⇞ \⇲ for the home/end and page up/down keys
  • \t for Tab, \n for Enter, \s for Space
  • additional codes for Backspace, Delete, Escape, no-break spaces?

fabi1cazenave avatar Feb 01 '24 08:02 fabi1cazenave

On Windows, if I am not mistaken, the feature works by using the proper VK. It should be ok to remap a key, but if you want it on a layer, I do not think you can use such special VK for both text & arrow.

wismill avatar Feb 05 '24 11:02 wismill

Summing up what @wismill has just explained on a Discord conversation, supporting arrow keys in an AltGr layer might be feasible if the driver changes the VK when a modifier is pressed (and that’s what this Japanese keyboard layout does, apparently).

So a reasonable first step would be to first support special key assignments from the command-line, e.g. to assign Backspace to the [B] key when applying an angle-mod.

fabi1cazenave avatar Feb 15 '24 12:02 fabi1cazenave