aboutsummaryrefslogtreecommitdiff
path: root/users/replicaJunction/process_records.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/replicaJunction/process_records.c')
-rw-r--r--users/replicaJunction/process_records.c149
1 files changed, 149 insertions, 0 deletions
diff --git a/users/replicaJunction/process_records.c b/users/replicaJunction/process_records.c
new file mode 100644
index 000000000..abce21526
--- /dev/null
+++ b/users/replicaJunction/process_records.c
@@ -0,0 +1,149 @@
1/* Copyright 2021 Joshua T.
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18#include "process_records.h"
19
20uint8_t mod_state;
21
22
23__attribute__ ((weak))
24bool process_record_user_kb(uint16_t keycode, keyrecord_t *record) {
25 return true;
26}
27
28// Runs for each key down or up event.
29bool process_record_user(uint16_t keycode, keyrecord_t *record) {
30 // Returning true here will cause QMK to continue handling the key normally.
31 // Returning false indicates that we've handled everything the keycode should do, and QMK
32 // should not continue handling the keypress.
33 //
34 // NOTE: There is also a process_record_kb function that can be defined in the keyboard-
35 // specific code. This allows the keyboard to have its own process_record function.
36 // This is supposed to be "higher" than the user function, meaning the kb function
37 // is shared for all keymaps for the keyboard.
38 //
39 // For this reason, I add my own function, called process_record_user_kb, and at the end
40 // of this function, I defer to that one if it exists.
41 // return process_record_user(keycode, record);
42
43
44 // Custom keycode / function handling, based on the core function
45 // process_record_quantum
46 // https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c
47
48 if (!(
49#ifdef USER_CAPS_WORD_ENABLE
50 process_record_caps_word(keycode, record) &&
51#endif
52#ifdef USER_MOUSE_JIGGLE_ENABLE
53 process_record_mouse_jiggle(keycode, record) &&
54#endif
55#ifdef USER_NUM_WORD_ENABLE
56 process_record_num_word(keycode, record) &&
57#endif
58#ifdef USER_SECRETS_ENABLE
59 process_record_secrets(keycode, record) &&
60#endif
61#ifdef USER_SUPER_ALT_TAB_ENABLE
62 process_record_super_alt_tab(keycode, record) &&
63#endif
64 true)) {
65 return false;
66 }
67
68
69 // Miscellaneous keycode handling
70 mod_state = get_mods();
71
72 switch(keycode)
73 {
74 case QK_MAKE: {
75 if (record->event.pressed)
76 SEND_STRING("qmk compile --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP);
77 return false;
78 }
79 case QK_FLSH: {
80 if (record->event.pressed) {
81 SEND_STRING("qmk flash --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP);
82 }
83 return false;
84 }
85 case QK_VERS: {
86 if (record->event.pressed) {
87 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
88 }
89 return false;
90 }
91 case PRG_EQ: {
92 if (record->event.pressed) {
93 SEND_STRING("==");
94 }
95 return false;
96 }
97 case PRG_NE: {
98 if (record->event.pressed) {
99 SEND_STRING("!=");
100 }
101 return false;
102 }
103 case PRG_GEQ: {
104 if (record->event.pressed) {
105 SEND_STRING(">=");
106 }
107 return false;
108 }
109 case PRG_LEQ: {
110 if (record->event.pressed) {
111 SEND_STRING("<=");
112 }
113 return false;
114 }
115 case PRG_ARR: {
116 if (record->event.pressed) {
117 SEND_STRING("=>");
118 }
119 return false;
120 }
121
122 case PS_ITEM: {
123 if (record->event.pressed) {
124 SEND_STRING("$_");
125 }
126 return false;
127 }
128 case FS_PIPE: {
129 if (record->event.pressed) {
130 SEND_STRING("|>");
131 }
132 return false;
133 }
134 case FS_ARR: {
135 if (record->event.pressed) {
136 SEND_STRING("->");
137 }
138 return false;
139 }
140 case SHEBANG: {
141 if (record->event.pressed) {
142 SEND_STRING("#!");
143 }
144 return false;
145 }
146 }
147
148 return process_record_user_kb(keycode, record);
149}