1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
// Copyright 2025 [email protected]
// SPDX-License-Identifier: GPL-2.0-or-later
#include "jack.h"
#ifndef CUSTOM_TAP_CODE_ENABLE
#define tap_string send_string_P
#endif
#define INTERCEPT_MOD_TAP(mod, keycode) \
case mod(keycode): \
if (record->tap.count && record->event.pressed) { \
tap_code16(keycode); \
return false; \
} \
break;
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LWRSPC:
case ESCLWR:
case RSEBSP:
return TAPPING_TERM - 40;
case TD(EM_DASH_MINS):
case TD(PLY_NXT_PRV):
case TD(CBRACKET):
case TD(SBRACKET):
return TAPPING_TERM + 60;
default:
return TAPPING_TERM;
}
}
#ifdef TAP_DANCE_ENABLE
void td_reset(tap_dance_state_t *state, void *user_data) {
clear_keyboard();
layer_clear();
}
void em_dash_mins(tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 3:
#ifdef UNICODE_COMMON_ENABLE
register_unicode(0x2014); // —
#endif
break;
case 2:
tap_code(KC_MINS), tap_code(KC_MINS);
break;
default:
tap_code(KC_MINS);
}
}
void ply_nxt_prv(tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
tap_code(KC_MPLY);
break;
case 2:
tap_code(KC_MNXT);
break;
case 3:
tap_code(KC_MPRV);
break;
}
}
void raise_paste(tap_dance_state_t *state, void *user_data) {
if (state->pressed && !state->interrupted)
layer_on(_RAISE);
else if (state->count == 1)
tap_code16(C(S(KC_V)));
}
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef UNICODE_COMMON_ENABLE
if (!process_record_unicode(keycode, record))
return false;
#endif
#ifdef CUSTOM_TAP_CODE_ENABLE
if (!process_record_taps(keycode, record))
return false;
#endif
#ifdef OLED_ENABLE
if (record->event.pressed) {
oled_timer_reset();
add_keylog(keycode, record);
}
#endif
#ifdef MOUSE_JIGGLE_ENABLE
if (record->event.pressed) {
static deferred_token token = INVALID_DEFERRED_TOKEN;
static report_mouse_t report = {0};
if (token) {
cancel_deferred_exec(token);
token = INVALID_DEFERRED_TOKEN;
report = (report_mouse_t){};
host_mouse_send(&report);
} else if (keycode == M_JIGGLE) {
uint32_t jiggle_callback(uint32_t trigger_time, void *cb_arg) {
static const int8_t deltas[32] = {
0, -1, -2, -2, -3, -3, -4, -4, -4, -4, -3, -3, -2, -2, -1, 0,
0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 3, 3, 2, 2, 1, 0};
static uint8_t phase = 0;
report.x = deltas[phase];
report.y = deltas[(phase + 8) & 31];
phase = (phase + 1) & 31;
host_mouse_send(&report);
return 16;
}
token = defer_exec(1, jiggle_callback, NULL);
}
}
#endif
switch (keycode) {
case UPDIR:
if (record->event.pressed)
tap_string(PSTR("../"));
break;
case REMOVE:
if (record->event.pressed) {
tap_string(PSTR("```suggestion\n```"));
tap_code(KC_UP);
tap_code(KC_UP);
tap_code(KC_ENT);
tap_code(KC_UP);
}
break;
INTERCEPT_MOD_TAP(LALT_T, KC_EXLM)
INTERCEPT_MOD_TAP(LGUI_T, KC_AT)
INTERCEPT_MOD_TAP(LCTL_T, KC_HASH)
INTERCEPT_MOD_TAP(LSFT_T, KC_DLR)
INTERCEPT_MOD_TAP(RSFT_T, KC_AMPR)
INTERCEPT_MOD_TAP(RCTL_T, KC_ASTR)
INTERCEPT_MOD_TAP(RGUI_T, KC_LPRN)
INTERCEPT_MOD_TAP(RALT_T, KC_RPRN)
}
return true;
}
|