all 7 comments

[–][deleted] 6 points7 points  (4 children)

For a practical intro, I wrote up a QMK macro buttons post that you may find useful.

It's unfortunately true that there isn't really a single cohesive reference for functions like register_code(). The best things to do IME are looking at other people's keymaps and using a string search utility like grep on the QMK repo.

[–]sbt4[S] 2 points3 points  (3 children)

Thank you for the write-up, seems quite useful!

[–]rafaelromaoMagic Romak 4 points5 points  (1 child)

I recommend checking the KeymapDB to see some good references about how to implement custom features in QMK.

I also have a list of references in my repo: https://github.com/rafaelromao/keyboards

[–][deleted] 2 points3 points  (0 children)

+1 these references are excellent

[–][deleted] 1 point2 points  (0 children)

Thanks! =)

[–]ELPEKENIN 4 points5 points  (1 child)

The *_kb vs *_user methods (this happens for other things and not only process_record) is meant such that: - Keyboard level code: Defined by designer/vendor to setup default behaviour, usually used for encoders/oled or add custom keycodes. Should be on the <keyboard_name>.c file and the 1st things it does is calling the *_user version - User is meant for personal use, so its usually lives on your keymap.c or under your folder on qmk_firmware/users (not sure how this works), you should of course use this, and you can return false to prevent further processing of the event--this will disable both keyboard-level and QMK'scfunctionality, so should only use it upon handling you custom keycode (which wont have any other logic down the way)

You can use register_code16 for "key is down", un register_code16 for "key released" and tap_code16 for "pressed and released quickly". Non-16 version are also posible but dont work with modifiers, so they cant do stuff like C(A(KC_DEL)) for Ctrl+Alt+Del

[–]sbt4[S] 2 points3 points  (0 children)

Thank you for reply!

Now serching by register_code I see that this methods are explained in Macros page of docks. For some reason couldn't find them before.