qmk / qmk_configurator

The QMK Configurator
http://config.qmk.fm
675 stars 340 forks source link

loading default keymaps #197

Open yanfali opened 5 years ago

yanfali commented 5 years ago

https://api.qmk.fm/v1/keyboards/nyquist

returns a datastructure with a field called keymaps

"keymaps":["yshrsmz","DivergeJM","losinggeneration","333fred","kim-kim","danielhklein","pitty","jojiichan","default"]

assuming a keymaps field exists, search for default and use it to load the keymap. If no default exists attempt to load the first one in the list.

https://api.qmk.fm/v1/keyboards//keymaps/

Returns a data structure that looks like this:

{
   "layout_macro" : "LAYOUT",
   "layers" : [
      [ "KC_1" ],
      [ "KC_F1" ],
      [ "KC_SPC" ],
   ],
   "keymap_folder" : "qmk_firmware/keyboards/nyquist/keymaps",
   "keyboard_name" : "nyquist",
   "keymap_name" : "default"
}

Use the layers info to pre-populate the keymap on configurator when there's a matching LAYOUT macro.

Two error conditions that currently exist.

  1. Sometimes keymaps: default: will be null.
  2. Sometimes layers will be empty

These are failures to parse the existing keymap and in those cases doing nothing is acceptable.

skullydazed commented 5 years ago
"keymaps": {
     'LAYOUT': ["yshrsmz","DivergeJM","losinggeneration","333fred","kim-kim","danielhklein","pitty","jojiichan","default"],
    'LAYOUT_60_ansi': ['layout1', 'layout2']
}
yanfali commented 5 years ago

Yeah this makes more sense as we have multiple layouts. I like it.