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
141
142
143
144
145
146
147
148
149
|
/* Copyright 2021 Joshua T.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "process_records.h"
uint8_t mod_state;
__attribute__ ((weak))
bool process_record_user_kb(uint16_t keycode, keyrecord_t *record) {
return true;
}
// Runs for each key down or up event.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Returning true here will cause QMK to continue handling the key normally.
// Returning false indicates that we've handled everything the keycode should do, and QMK
// should not continue handling the keypress.
//
// NOTE: There is also a process_record_kb function that can be defined in the keyboard-
// specific code. This allows the keyboard to have its own process_record function.
// This is supposed to be "higher" than the user function, meaning the kb function
// is shared for all keymaps for the keyboard.
//
// For this reason, I add my own function, called process_record_user_kb, and at the end
// of this function, I defer to that one if it exists.
// return process_record_user(keycode, record);
// Custom keycode / function handling, based on the core function
// process_record_quantum
// https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c
if (!(
#ifdef USER_CAPS_WORD_ENABLE
process_record_caps_word(keycode, record) &&
#endif
#ifdef USER_MOUSE_JIGGLE_ENABLE
process_record_mouse_jiggle(keycode, record) &&
#endif
#ifdef USER_NUM_WORD_ENABLE
process_record_num_word(keycode, record) &&
#endif
#ifdef USER_SECRETS_ENABLE
process_record_secrets(keycode, record) &&
#endif
#ifdef USER_SUPER_ALT_TAB_ENABLE
process_record_super_alt_tab(keycode, record) &&
#endif
true)) {
return false;
}
// Miscellaneous keycode handling
mod_state = get_mods();
switch(keycode)
{
case QK_MAKE: {
if (record->event.pressed)
SEND_STRING("qmk compile --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP);
return false;
}
case QK_FLSH: {
if (record->event.pressed) {
SEND_STRING("qmk flash --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP);
}
return false;
}
case QK_VERS: {
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
}
return false;
}
case PRG_EQ: {
if (record->event.pressed) {
SEND_STRING("==");
}
return false;
}
case PRG_NE: {
if (record->event.pressed) {
SEND_STRING("!=");
}
return false;
}
case PRG_GEQ: {
if (record->event.pressed) {
SEND_STRING(">=");
}
return false;
}
case PRG_LEQ: {
if (record->event.pressed) {
SEND_STRING("<=");
}
return false;
}
case PRG_ARR: {
if (record->event.pressed) {
SEND_STRING("=>");
}
return false;
}
case PS_ITEM: {
if (record->event.pressed) {
SEND_STRING("$_");
}
return false;
}
case FS_PIPE: {
if (record->event.pressed) {
SEND_STRING("|>");
}
return false;
}
case FS_ARR: {
if (record->event.pressed) {
SEND_STRING("->");
}
return false;
}
case SHEBANG: {
if (record->event.pressed) {
SEND_STRING("#!");
}
return false;
}
}
return process_record_user_kb(keycode, record);
}
|