Defining keymaps using Rust

This article on the use of Rust macros to define keymaps in QMK might be of interest.

@AmigoNico, thanks for posting that rust-article. I found it very inspiring. It gave me the idea that we could do something similar in Kaleidoscope to make life of non-english speakers easier.

Here’s an example of what C++ has to offer in terms of KEYMAPS readability.

#include "kaleidoscope/host_keymap/linux/eu/standard/keymap.h"

USE_HOST_KEYMAP(linux, eu, standard)

KEYMAPS(
  [0] = KEYMAP_STACKED
  (
      XXX,   "1",   "2",   "3",   "4",   "5",   XXX,
      "`",   "q",   "w",   "e",   "r",   "t",   L"↹",
     L"⇞",   "ü",   "ß",   "d",   "f",   "g",
     L"⇟",   "z",   "x",   "c",   "v",   "b",   L"⎋",

     L"⌃",  L"⌫",  L"⌘",  L"⇧",
      XXX,

      XXX,   "6",   "7",   "8",   "9",   "0",   XXX,
     L"⎆",   "y",   "u",   "i",   "o",   "p",   "=",
             "h",   "j",   "k",   "l",   ";",  "\"",
      XXX,   "n",   "m",   ",",   ".",   "/",   "-",

    L"r⇧", L"r⌥",  L"␣", L"r⌃",
      XXX
  )
)

Not exactly as convenient as what rust has to offer (quotes :tired_face:), but close. And still way more convenient than fiddeling with Key_... values directly (especially on non-us keymaps). ASCII characters can be supplied double quotes, utf-8 unicode characters come with a leading L.

I submitted a PR to Kaleidoscope

The newly implemented system supports all 633 keymaps currently available on GNU/Linux out of the box (untested on other OS but hopefully still useful there). It allows not only to use utf-8 characters directly in the Kaleidoscope KEYMAP, but those characters will automatically generate the matching characters on the host as long as the host-keymap used in the sketch and the actual keymap running on the host do match.

That does away with the burden to wrap ones head around the question what-Key-do-I-have-to-put-in-the-KEYMAP-for-it-to-create-a-specific-symbol-on-the-host.

Apart from utf-8 printable characters, the new system also supports a set of control-characters like ⌫, ⇧, … for common actions like backspace, shift, enter, … Those are the characters that are typically printed on the keys.

Disclaimer: I can only hope but not guarantee that this PR is going to be accepted in its present form. I only post it here as I think it will be useful for non-english speakers and, if so, it might take a while for it to pass t review process.

Nice work! Whether in its present form or not, I hope something comes of it.