aboutsummaryrefslogtreecommitdiff
path: root/users/greatwizard/programmer.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/greatwizard/programmer.c')
-rw-r--r--users/greatwizard/programmer.c174
1 files changed, 174 insertions, 0 deletions
diff --git a/users/greatwizard/programmer.c b/users/greatwizard/programmer.c
new file mode 100644
index 000000000..e0f71ea06
--- /dev/null
+++ b/users/greatwizard/programmer.c
@@ -0,0 +1,174 @@
1/* Copyright 2020 Guillaume Gérard
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#include "programmer.h"
17
18bool process_record_pg(uint16_t keycode, keyrecord_t *record) {
19 switch (keycode) {
20 case QWERTY_PROGRAMMER:
21 if (record->event.pressed) {
22 set_single_persistent_default_layer(_QWERTY_PROGRAMMER);
23 }
24 return false;
25 case WORKMAN_PROGRAMMER:
26 if (record->event.pressed) {
27 set_single_persistent_default_layer(_WORKMAN_PROGRAMMER);
28 }
29 return false;
30 case COLEMAK_PROGRAMMER:
31 if (record->event.pressed) {
32 set_single_persistent_default_layer(_COLEMAK_PROGRAMMER);
33 }
34 return false;
35 case DVORAK_PROGRAMMER:
36 if (record->event.pressed) {
37 set_single_persistent_default_layer(_DVORAK_PROGRAMMER);
38 }
39 return false;
40 case PG_GRV:
41 if (record->event.pressed) {
42 uint8_t current_mods = get_mods();
43 if (current_mods & MOD_MASK_SHIFT) {
44 clear_mods();
45 SEND_STRING("`");
46 set_mods(current_mods);
47 } else {
48 SEND_STRING("~");
49 }
50 }
51 return false;
52 case PG_1:
53 if (record->event.pressed) {
54 uint8_t current_mods = get_mods();
55 if (current_mods & MOD_MASK_SHIFT) {
56 clear_mods();
57 SEND_STRING("1");
58 set_mods(current_mods);
59 } else {
60 SEND_STRING("!");
61 }
62 }
63 return false;
64 case PG_2:
65 if (record->event.pressed) {
66 uint8_t current_mods = get_mods();
67 if (current_mods & MOD_MASK_SHIFT) {
68 clear_mods();
69 SEND_STRING("2");
70 set_mods(current_mods);
71 } else {
72 SEND_STRING("@");
73 }
74 }
75 return false;
76 case PG_3:
77 if (record->event.pressed) {
78 uint8_t current_mods = get_mods();
79 if (current_mods & MOD_MASK_SHIFT) {
80 clear_mods();
81 SEND_STRING("3");
82 set_mods(current_mods);
83 } else {
84 SEND_STRING("#");
85 }
86 }
87 return false;
88 case PG_4:
89 if (record->event.pressed) {
90 uint8_t current_mods = get_mods();
91 if (current_mods & MOD_MASK_SHIFT) {
92 clear_mods();
93 SEND_STRING("4");
94 set_mods(current_mods);
95 } else {
96 SEND_STRING("$");
97 }
98 }
99 return false;
100 case PG_5:
101 if (record->event.pressed) {
102 uint8_t current_mods = get_mods();
103 if (current_mods & MOD_MASK_SHIFT) {
104 clear_mods();
105 SEND_STRING("5");
106 set_mods(current_mods);
107 } else {
108 SEND_STRING("%");
109 }
110 }
111 return false;
112 case PG_6:
113 if (record->event.pressed) {
114 uint8_t current_mods = get_mods();
115 if (current_mods & MOD_MASK_SHIFT) {
116 clear_mods();
117 SEND_STRING("6");
118 set_mods(current_mods);
119 } else {
120 SEND_STRING("^");
121 }
122 }
123 return false;
124 case PG_7:
125 if (record->event.pressed) {
126 uint8_t current_mods = get_mods();
127 if (current_mods & MOD_MASK_SHIFT) {
128 clear_mods();
129 SEND_STRING("7");
130 set_mods(current_mods);
131 } else {
132 SEND_STRING("&");
133 }
134 }
135 return false;
136 case PG_8:
137 if (record->event.pressed) {
138 uint8_t current_mods = get_mods();
139 if (current_mods & MOD_MASK_SHIFT) {
140 clear_mods();
141 SEND_STRING("8");
142 set_mods(current_mods);
143 } else {
144 SEND_STRING("*");
145 }
146 }
147 return false;
148 case PG_9:
149 if (record->event.pressed) {
150 uint8_t current_mods = get_mods();
151 if (current_mods & MOD_MASK_SHIFT) {
152 clear_mods();
153 SEND_STRING("9");
154 set_mods(current_mods);
155 } else {
156 SEND_STRING("(");
157 }
158 }
159 return false;
160 case PG_0:
161 if (record->event.pressed) {
162 uint8_t current_mods = get_mods();
163 if (current_mods & MOD_MASK_SHIFT) {
164 clear_mods();
165 SEND_STRING("0");
166 set_mods(current_mods);
167 } else {
168 SEND_STRING(")");
169 }
170 }
171 return false;
172 }
173 return true;
174}