summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-11-12 22:15:05 +0000
committerQMK Bot <hello@qmk.fm>2021-11-12 22:15:05 +0000
commit4ceb5947f9f3fc47de9c4f4b6b785bdc13db15e5 (patch)
tree19378e87242c51a88f847b491988a37ac8302078
parentbd3597825409e13096e2a444ad224f07321cebbf (diff)
parent57f63e43d862d3c36ee1e530920f7ee40e9713a2 (diff)
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--docs/mod_tap.md23
1 files changed, 10 insertions, 13 deletions
diff --git a/docs/mod_tap.md b/docs/mod_tap.md
index b69500f9c9..dc11b0dea9 100644
--- a/docs/mod_tap.md
+++ b/docs/mod_tap.md
@@ -83,32 +83,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
### Changing hold function
-Likewise, the same custom code can also be used to intercept the hold function to send custom user key code. The following example uses `LT(0, kc)` (layer-tap key with no practical use because layer 0 is always active) to add cut, copy and paste function to X,C and V keys when they are held down:
+Likewise, similar custom code can also be used to intercept the hold function to send custom user key code. The following example uses `LT(0, kc)` (layer-tap key with no practical use because layer 0 is always active) to add cut, copy and paste function to X,C and V keys when they are held down:
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LT(0,KC_X):
- if (record->tap.count && record->event.pressed) {
- return true; // Return true for normal processing of tap keycode
- } else if (record->event.pressed) {
+ if (!record->tap.count && record->event.pressed) {
tap_code16(C(KC_X)); // Intercept hold function to send Ctrl-X
+ return false;
}
- return false;
+ return true; // Return true for normal processing of tap keycode
case LT(0,KC_C):
- if (record->tap.count && record->event.pressed) {
- return true; // Return true for normal processing of tap keycode
- } else if (record->event.pressed) {
+ if (!record->tap.count && record->event.pressed) {
tap_code16(C(KC_C)); // Intercept hold function to send Ctrl-C
+ return false;
}
- return false;
+ return true; // Return true for normal processing of tap keycode
case LT(0,KC_V):
- if (record->tap.count && record->event.pressed) {
- return true; // Return true for normal processing of tap keycode
- } else if (record->event.pressed) {
+ if (!record->tap.count && record->event.pressed) {
tap_code16(C(KC_V)); // Intercept hold function to send Ctrl-V
+ return false;
}
- return false;
+ return true; // Return true for normal processing of tap keycode
}
return true;
}