urob / zmk-helpers

Convenience macros simplifying ZMK's keymap configuration
MIT License
235 stars 79 forks source link

Add Glove80 keypos definitions #22

Closed hylophile closed 1 year ago

hylophile commented 1 year ago

Hi,

first off, thank you for this project! This PR adds key position definitions for the Glove80 keyboard.

Comparing with the ADV360 thumb key definitions, my choice here is probably not really compatible for someone using both boards, since for the ADV360, the two easiest to reach thumb keys are XH0 and XH1, whereas here they're XH1 and XH2. On the other hand, it'd be confusing for users who only use the Glove80 to use XH1 XH0 XH2. Not sure what's the best approach here.

I also wrote a macro for defining Glove80 layers which is quite handy. The key positions for the two thumb rows are between rows (and not after them), which ends up taking a lot of vertical space when aligning them properly. The macro just takes a couple of arguments and rearranges them to fix this, allowing users to define layouts the following way:

GLV80_LAYER(template,
/* ╭───────────────┬───────────────┬───────────────┬───────────────┬───────────────╮                                   ╭───────────────┬───────────────┬───────────────┬───────────────┬───────────────╮ */
    ___             ___             ___             ___             ___                                                 ___             ___             ___             ___             ___
/* ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────╮   ╭───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ */
    ___             ___             ___             ___             ___             ___                 ___             ___             ___             ___             ___             ___
/* ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤   ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ */
    ___             ___             ___             ___             ___             ___                 ___             ___             ___             ___             ___             ___
/* ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤   ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ */
    ___             ___             ___             ___             ___             ___                 ___             ___             ___             ___             ___             ___
/* ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤   ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ */
    ___             ___             ___             ___             ___             ___              ,  ___             ___             ___             ___             ___             ___
/* ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────╯   ╰───────────────┼───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤ */
    ___             ___             ___             ___             ___                              ,                  ___             ___             ___             ___             ___
/* ╰───────────────┴───────────────┴───────────────┴───────────────┴───────────────╯                                   ╰───────────────┴───────────────┴───────────────┴───────────────┴───────────────╯ */
                                                                                                     ,
/*                                         ╭───────────────┬───────────────┬───────────────╮                   ╭───────────────┬───────────────┬───────────────╮                                         */
                                            ___             ___             ___                                 ___             ___             ___
/*                                         ├───────────────┼───────────────┼───────────────┤      */ , /*      ├───────────────┼───────────────┼───────────────┤                                         */
                                            ___             ___             ___                                 ___             ___             ___
/*                                         ╰───────────────┴───────────────┴───────────────╯                   ╰───────────────┴───────────────┴───────────────╯                                         */
)

I'd be glad to include the macro in this PR, but wasn't sure whether it fits the project. In any case, I'll leave it here for posterity.

urob commented 1 year ago

Thanks! Looks good to me. The layer macro seems useful and it doesn't hurt to include it in the definition file. So if you want to update the PR, I'd be happy to include it.

hylophile commented 1 year ago

Great! I've added the macro. Thanks for the quick feedback!

bryanforbes commented 1 year ago

Should the keypos file define its own stringify macro and stringify the label like ZMK_LAYER() does? Or should the macro expect to be included after helper.h and use ZMK_LAYER() directly?

urob commented 1 year ago

I'd say let's re-use the existing macros and add a note in the comment above that it must be sourced after helper.h

hylophile commented 1 year ago

Done. I've also changed the numbering of the keypos definitions slightly so that LFx, RFx, LCx and RCx align with the other rows, and renamed the macro to GLV80_LAYER. The first comment now includes a proper template for users.

urob commented 1 year ago

Merged! Thanks for submitting!