-
Notifications
You must be signed in to change notification settings - Fork 8
1.0: Installation guide
// page_updated: 2024-08-25
// lib_version: 0.4.0
-
Add
DEFERRED_EXEC_ENABLE = yes
to yourrules.mk
file. -
Add
#define MAX_DEFERRED_EXECUTORS 10
(or add 10 if you already use it) to yourconfig.h
file. -
Clone the
sm_td.h
repository into yourkeymaps/your_keymap
folder (next to yourkeymap.c
) -
Add
#include "sm_td.h"
to yourkeymap.c
file. !!! WARNING !!! There is a bug in v0.4.0 and the library would compile with a "'SMTD_KEYCODES_BEGIN' undeclared" error. You need to put this #include "sm_td.h" right after you define your custom keycodes enum (described on p.6). -
Check
!process_smtd
first in yourprocess_record_user
function like thisbool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_smtd(keycode, record)) { return false; } // your code here }
-
Add
SMTD_KEYCODES_BEGIN
andSMTD_KEYCODES_END
to you custom keycodes, and put each new custom keycode you want to use withsm_td
between them. For example, if you want to useA
,S
,D
andF
for HRM, you need to create a custom keycode for them like thisenum custom_keycodes { SMTD_KEYCODES_BEGIN = SAFE_RANGE, CKC_A, // reads as C(ustom) + KC_A, but you may give any name here CKC_S, CKC_D, CKC_F, SMTD_KEYCODES_END, };
Please don't forget to put ; at the end of the enum definition. Normally it's not necessary, but if you put #include "sm_td.h" it will break compilation. Note that
SAFE_RANGE
is a predefined constant in QMK, and is used to define custom keycodes. You need to put it on the beginning of your custom keycodes enum. Some keyboards may have their ownSAFE_RANGE
constant, so you need to check your firmware for this constant. -
Place all your custom keycodes on the desired key positions in your
keymaps
. -
Create a
void on_smtd_action(uint16_t keycode, smtd_action action, uint8_t tap_count)
function that would handle all the actions of the custom keycodes you defined in the previous step. For example, if you want to useCKC_A
,CKC_S
,CKC_D
andCKC_F
for HRM, youron_smtd_action()
function will look like thisvoid on_smtd_action(uint16_t keycode, smtd_action action, uint8_t tap_count) { } switch (keycode) { SMTD_MT(CKC_A, KC_A, KC_LEFT_GUI) SMTD_MT(CKC_S, KC_S, KC_LEFT_ALT) SMTD_MT(CKC_D, KC_D, KC_LEFT_CTRL) SMTD_MT(CKC_F, KC_F, KC_LSFT) } }
See extensive documentation in the Customization Guide with cool Examples
-
(optional) Add global configuration parameters to your
config.h
file (see timeouts and feature flags). -
(optional) Add per-key configuration (see timeouts and feature flags)