aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kagno <cwre@protonmail.com>2018-09-22 09:43:28 -0600
committerDrashna Jaelre <drashna@live.com>2018-09-22 08:43:28 -0700
commit35e76539e7257a1932ec76882892b999e21c9d4f (patch)
tree5c363a2d7eb8f8d0c5d85394064f5219fa469f03
parent747cf78b5da17969fe057d77512e276fa6c59fd9 (diff)
downloadqmk_firmware-35e76539e7257a1932ec76882892b999e21c9d4f.tar.gz
qmk_firmware-35e76539e7257a1932ec76882892b999e21c9d4f.zip
Keymap: Arkag Userspace and MechMini2 Layout (#3958)
* deleting arkag branch, forcibly moving changes over to master * fade_color function added, not tested * added half functions some stuff * surround_type function implemented and working. * added flashing function and removed fading, flashing supports infinite flashing along with controlled number flashes * added a fade state machine and functionality * build optimizations, changed fade to bounce between bounds rather than roll over, added a HALMAK layout * changes to sleep breath function, changed how I will switch to HALMAK * support for halmak added * support for activity detection added, condensed fading and flashing state machines, removed support for HALMAK and COLEMAK because arkag is stupid * changed sleep and inactive behaviors, now the color shifting reverses on state change, yay! save_color and reset_color are made to enable layer color changing to look cooler. * reformatted some if statements in state detection * changes to force fade to pause on boot, or plug in. * Attempting to move over to userspace, pushing to repository for help * userspace stuff.... * userspace stuff.... * layout changes, working userspace, Removed left side shift and replaced it with a MT() for LSFT and SPC. Userspace seems to be working properly now! HURRAY * Layout change Removed space/shift and reset modifiers to what they were originally. Added homerow modifiers. * Removed excessive tabs in files * Moved mods on homerow around... * changes recommended by @drashna
-rw-r--r--keyboards/mechmini/v2/keymaps/arkag/config.h7
-rw-r--r--keyboards/mechmini/v2/keymaps/arkag/keymap.c40
-rw-r--r--keyboards/mechmini/v2/keymaps/arkag/rules.mk16
-rw-r--r--users/arkag/arkag.c573
-rw-r--r--users/arkag/arkag.h161
-rw-r--r--users/arkag/config.h5
-rw-r--r--users/arkag/readme.md14
-rw-r--r--users/arkag/rules.mk1
8 files changed, 817 insertions, 0 deletions
diff --git a/keyboards/mechmini/v2/keymaps/arkag/config.h b/keyboards/mechmini/v2/keymaps/arkag/config.h
new file mode 100644
index 000000000..f5f3a90fa
--- /dev/null
+++ b/keyboards/mechmini/v2/keymaps/arkag/config.h
@@ -0,0 +1,7 @@
1#pragma once
2
3// save me space!
4#define NO_ACTION_MACRO
5#define NO_ACTION_FUNCTION
6#define DISABLE_LEADER
7#define NO_MUSIC_MODE
diff --git a/keyboards/mechmini/v2/keymaps/arkag/keymap.c b/keyboards/mechmini/v2/keymaps/arkag/keymap.c
new file mode 100644
index 000000000..10502a5b6
--- /dev/null
+++ b/keyboards/mechmini/v2/keymaps/arkag/keymap.c
@@ -0,0 +1,40 @@
1#include QMK_KEYBOARD_H
2#include "arkag.h"
3
4const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 [_QWERTY] = LAYOUT_2u_space_ortho(
6 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
7 KC_TAB, TAP_A, TAP_S, TAP_D, TAP_F, KC_G, KC_H, TAP_J, TAP_K, TAP_L, TAP_SCN, QUOTE,
8 XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT,
9 M_PMOD, LRALT, M_SMOD, LOWER, RAISE, KC_SPC, KC_SLSH, LAZY, KC_LEFT, KC_DOWN, KC_RGHT),
10
11 [_RAISE] = LAYOUT_2u_space_ortho(
12 GRAVE, KC_1, KC_2, THREE, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
13 _______, OBRACK, CBRACK, TAP_EQ, HYPHEN, _______, _______, KC_4, TAP_5, KC_6, _______, KC_NLCK,
14 _______, _______, _______, CEDILLA, _______, KC_COMM, KC_PDOT, KC_1, KC_2, KC_3, KC_PPLS, KC_PENT,
15 _______, _______, _______, KEEB, _______, _______, _______, M_OS, KC_PSLS, KC_PMNS, KC_PAST),
16
17 [_LOWER] = LAYOUT_2u_space_ortho(
18 _______, _______, _______, _______, _______, _______, _______, M_ULIN, M_ITAL, _______, M_P_B, M_C_A_D,
19 _______, _______, STRIKE, _______, _______, _______, _______, _______, _______, _______, _______, _______,
20 KC_CAPS, KC_DEL, _______, _______, _______, M_BOLD, _______, _______, _______, _______, KC_PGUP, _______,
21 _______, _______, _______, _______, _______, MEDIA, KC_BSLS, M_CALC, KC_HOME, KC_PGDN, KC_END),
22
23 [_KEEB] = LAYOUT_2u_space_ortho(
24 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
25 _______, BL_TOGG, BL_STEP, BL_INC, BL_DEC, BL_BRTG, _______, _______, _______, _______, _______, _______,
26 RGB_M_P, RGB_TOG, RGB_MOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, _______, _______, _______,
27 RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
28
29 [_MEDIA] = LAYOUT_2u_space_ortho(
30 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
31 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
32 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_VOLU, KC_MUTE,
33 _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT),
34
35 [_LAZY] = LAYOUT_2u_space_ortho(
36 _______, _______, _______, _______, _______, M_TM, _______, M_SNIPT, M_SHRUG, _______, _______, _______,
37 _______, _______, _______, _______, _______, M_GGT, _______, M_UF, M_LOD, M_REPO, _______, _______,
38 _______, _______, _______, _______, _______, _______, _______, M_TF, M_LENNY, _______, _______, _______,
39 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
40};
diff --git a/keyboards/mechmini/v2/keymaps/arkag/rules.mk b/keyboards/mechmini/v2/keymaps/arkag/rules.mk
new file mode 100644
index 000000000..d6c210e9e
--- /dev/null
+++ b/keyboards/mechmini/v2/keymaps/arkag/rules.mk
@@ -0,0 +1,16 @@
1BOOTMAGIC_ENABLE = no
2MOUSEKEY_ENABLE = no
3STENO_ENABLE = no
4EXTRAKEY_ENABLE = yes
5CONSOLE_ENABLE = no
6COMMAND_ENABLE = no
7SLEEP_LED_ENABLE = no
8NKRO_ENABLE = yes
9BACKLIGHT_ENABLE = yes
10AUDIO_ENABLE = no
11RGBLIGHT_ENABLE = yes
12TAP_DANCE_ENABLE = yes
13UNICODE_ENABLE = yes
14
15# save me space!
16EXTRAFLAGS += -flto
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c
new file mode 100644
index 000000000..c716b5e93
--- /dev/null
+++ b/users/arkag/arkag.c
@@ -0,0 +1,573 @@
1#include "arkag.h"
2
3// Start: Written by konstantin: vomindoraan
4#include <ctype.h>
5#include <stdlib.h>
6#include <string.h>
7
8void send_unicode_hex_string(const char *str) {
9 if (!str) { return; } // Saftey net
10 while (*str) {
11 // Find the next code point (token) in the string
12 for (; *str == ' '; str++);
13 size_t n = strcspn(str, " "); // Length of the current token
14 char code_point[n+1];
15 strncpy(code_point, str, n);
16 code_point[n] = '\0'; // Make sure it's null-terminated
17
18 // Normalize the code point: make all hex digits lowercase
19 for (char *p = code_point; *p; p++) {
20 *p = tolower(*p);
21 }
22
23 // Send the code point as a Unicode input string
24 unicode_input_start();
25 send_string(code_point);
26 unicode_input_finish();
27 str += n; // Move to the first ' ' (or '\0') after the current token
28 }
29}
30// End: Written by konstantin: vomindoraan
31
32uint8_t current_os, mod_primary_mask, fade_delay;
33uint16_t flash_timer_one, flash_timer_two,
34 fade_timer_one, fade_timer_two,
35 active_timer_one, active_timer_two,
36 elapsed = 0,
37 num_extra_flashes_off = 0;
38Color underglow,
39 flash_color,
40 saved_color,
41 hsv_none = {0,0,0},
42 hsv_white = {0,0,127};
43flashState flash_state = no_flash;
44fadeState fade_state = add_fade;
45activityState state = boot;
46
47void set_color (Color new, bool update) {
48 rgblight_sethsv_eeprom_helper(new.h, new.s, new.v, update);
49}
50
51void save_color(Color to_save) {
52 saved_color = to_save;
53}
54
55void reset_color(void) {
56 underglow = saved_color;
57}
58
59Color mod_color(Color current_color, bool should_add, uint8_t change_amount) {
60 save_color(underglow);
61 int addlim = 359 - change_amount;
62 int sublim = change_amount;
63 int leftovers;
64 if (should_add) {
65 if (current_color.h <= addlim) {
66 current_color.h += change_amount;
67 } else {
68 leftovers = (359 + change_amount) % 359;
69 current_color.h = 0 + leftovers;
70 }
71 } else {
72 if (current_color.h >= sublim) {
73 current_color.h -= change_amount;
74 } else {
75 leftovers = change_amount - current_color.h;
76 current_color.h = 359 - leftovers;
77 }
78 }
79 return current_color;
80}
81
82void reverse_fade (void) {
83 if (fade_state == add_fade){
84 fade_state = sub_fade;
85 } else {
86 fade_state = add_fade;
87 }
88}
89
90void check_state (void) {
91 static bool activated, deactivated, slept;
92 switch (state) {
93 case active:
94 if (!activated) {
95 fade_delay = LED_FADE_DELAY;
96 reverse_fade();
97 activated = true;
98 deactivated = false;
99 }
100 active_timer_two = timer_read();
101 elapsed = active_timer_two - active_timer_one;
102 if (elapsed < INACTIVE_DELAY) {return;}
103 state = inactive;
104 return;
105
106 case inactive:
107 if (!deactivated) {
108 fade_delay = LED_FADE_DELAY * 2;
109 reverse_fade();
110 deactivated = true;
111 slept = false;
112 activated = false;
113 }
114 active_timer_two = timer_read();
115 elapsed = active_timer_two - active_timer_one;
116 if (elapsed < SLEEP_DELAY) {return;}
117 state = sleeping;
118 return;
119
120 case sleeping:
121 if (!slept) {
122 fade_delay = LED_FADE_DELAY * 6;
123 reverse_fade();
124 slept = true;
125 deactivated = false;
126 activated = false;
127 }
128 return;
129
130 case boot:
131 return;
132 }
133}
134
135void fade_rgb (void) {
136 static bool ran_once;
137 if (flash_state != no_flash) {return;}
138 if (state == boot) {return;}
139 switch (fade_state) {
140 case add_fade:
141 if (!ran_once) {
142 fade_timer_one = timer_read();
143 ran_once = true;
144 }
145 fade_timer_two = timer_read();
146 elapsed = fade_timer_two - fade_timer_one;
147 if (elapsed < fade_delay) {return;}
148 if (underglow.h == 359) {
149 fade_state = sub_fade;
150 return;
151 }
152 underglow.h = underglow.h + 1;
153 set_color(underglow, false);
154 // set_color_at(underglow, 0);
155 fade_timer_one = fade_timer_two;
156 return;
157
158 case sub_fade:
159 fade_timer_two = timer_read();
160 elapsed = fade_timer_two - fade_timer_one;
161 if (elapsed < fade_delay) {return;}
162 if (underglow.h == 0) {
163 fade_state = add_fade;
164 return;
165 }
166 underglow.h = underglow.h - 1;
167 set_color(underglow, false);
168 // set_color_at(underglow, 0);
169 fade_timer_one = fade_timer_two;
170 return;
171 }
172}
173
174void flash_rgb (void) {
175 static bool ran_once;
176 switch(flash_state) {
177 case no_flash:
178 return;
179
180 case flash_off:
181 if (!ran_once) {
182 set_color(hsv_none, false);
183 flash_timer_one = timer_read();
184 ran_once = true;
185 flash_state = flash_on;
186 return;
187 }
188 flash_timer_two = timer_read();
189 elapsed = flash_timer_two - flash_timer_one;
190 if (elapsed >= LED_FLASH_DELAY) {
191 set_color(hsv_none, false);
192 flash_timer_one = timer_read();
193 flash_state = flash_on;
194 }
195 return;
196
197 case flash_on:
198 flash_timer_two = timer_read();
199 elapsed = flash_timer_two - flash_timer_one;
200 if (elapsed >= LED_FLASH_DELAY) {
201 set_color(flash_color, false);
202 flash_timer_one = timer_read();
203 if (num_extra_flashes_off > 0) {
204 flash_state = flash_off;
205 num_extra_flashes_off--;
206 } else {
207 set_color(underglow, false);
208 flash_state = no_flash;
209 ran_once = false;
210 }
211 }
212 return;
213 }
214}
215
216void set_os (uint8_t os, bool update) {
217 current_os = os;
218 if (update) {
219 eeprom_update_byte(EECONFIG_USERSPACE, current_os);
220 }
221 switch (os) {
222 case OS_MAC:
223 set_unicode_input_mode(UC_OSX);
224 underglow = (Color){ 300, 255, 255 };
225 mod_primary_mask = MOD_GUI_MASK;
226 break;
227 case OS_WIN:
228 set_unicode_input_mode(UC_WINC);
229 underglow = (Color){ 180, 255, 255 };
230 mod_primary_mask = MOD_CTL_MASK;
231 break;
232 case OS_NIX:
233 set_unicode_input_mode(UC_LNX);
234 underglow = (Color){ 60, 255, 255 };
235 mod_primary_mask = MOD_CTL_MASK;
236 break;
237 default:
238 underglow = (Color){ 0, 0, 255 };
239 mod_primary_mask = MOD_CTL_MASK;
240 }
241 set_color(underglow, update);
242 flash_color = underglow;
243 flash_state = flash_off;
244 num_extra_flashes_off = 1;
245}
246
247void tap_key(uint8_t keycode) {
248 register_code(keycode);
249 unregister_code(keycode);
250}
251
252// register GUI if Mac or Ctrl if other
253void pri_mod(bool press) {
254 if (press) {
255 if (current_os == OS_MAC) {
256 register_code(KC_LGUI);
257 } else {
258 register_code(KC_LCTL);
259 }
260 } else {
261 if (current_os == OS_MAC) {
262 unregister_code(KC_LGUI);
263 } else {
264 unregister_code(KC_LCTL);
265 }
266 }
267}
268
269// register Ctrl if Mac or GUI if other
270void sec_mod(bool press) {
271 if (press) {
272 if (current_os == OS_MAC) {
273 register_code(KC_LCTL);
274 } else {
275 register_code(KC_LGUI);
276 }
277 } else {
278 if (current_os == OS_MAC) {
279 unregister_code(KC_LCTL);
280 } else {
281 unregister_code(KC_LGUI);
282 }
283 }
284}
285
286void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) {
287 if (use_shift) {
288 register_code(KC_LSFT);
289 }
290 for (int i = 0; i < num_of_chars; i++) {
291 tap_key(keycode);
292 }
293 if (use_shift) {
294 unregister_code(KC_LSFT);
295 }
296 for (int i = 0; i < (num_of_chars/2); i++) {
297 tap_key(KC_LEFT);
298 }
299}
300
301void long_keystroke(size_t num_of_keys, uint16_t keys[]) {
302 for (int i = 0; i < num_of_keys-1; i++) {
303 register_code(keys[i]);
304 }
305 tap_key(keys[num_of_keys-1]);
306 for (int i = 0; i < num_of_keys-1; i++) {
307 unregister_code(keys[i]);
308 }
309}
310
311void dance_grv (qk_tap_dance_state_t *state, void *user_data) {
312 if (state->count == 1) {
313 tap_key(KC_GRV);
314 } else if (state->count == 2) {
315 surround_type(2, KC_GRAVE, false);
316 } else {
317 surround_type(6, KC_GRAVE, false);
318 }
319}
320
321void dance_quot (qk_tap_dance_state_t *state, void *user_data) {
322 if (state->count == 1) {
323 tap_key(KC_QUOT);
324 } else if (state->count == 2) {
325 surround_type(2, KC_QUOTE, false);
326 } else if (state->count == 3) {
327 surround_type(2, KC_QUOTE, true);
328 }
329}
330
331void dance_strk (qk_tap_dance_state_t *state, void *user_data) {
332 if (state->count == 1) {
333 surround_type(4, KC_TILDE, true);
334 } else if (state->count == 2) {
335 if (current_os == OS_MAC) {
336 long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4});
337 } else if (current_os == OS_WIN) {
338 long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S});
339 } else {
340 return;
341 }
342 }
343}
344
345void dance_3 (qk_tap_dance_state_t *state, void *user_data) {
346 if (state->count == 1) {
347 tap_key(KC_3);
348 } else if (state->count == 2) {
349 send_unicode_hex_string("00E8");
350 } else if (state->count == 3) {
351 send_unicode_hex_string("00E9");
352 }
353}
354
355void dance_c (qk_tap_dance_state_t *state, void *user_data) {
356 if (state->count == 1) {
357 tap_key(KC_C);
358 } else if (state->count == 2) {
359 send_unicode_hex_string("00E7");
360 }
361}
362
363void matrix_init_user(void) {
364 current_os = eeprom_read_byte(EECONFIG_USERSPACE);
365 set_os(current_os, false);
366}
367
368void matrix_scan_user(void) {
369 check_state();
370 flash_rgb();
371 fade_rgb();
372}
373
374bool process_record_user(uint16_t keycode, keyrecord_t *record) {
375 switch (keycode) {
376 case M_PMOD:
377 if (record->event.pressed) {
378 pri_mod(true);
379 } else {
380 pri_mod(false);
381 }
382 return false;
383
384 case M_SMOD:
385 if (record->event.pressed) {
386 sec_mod(true);
387 } else {
388 sec_mod(false);
389 }
390 return false;
391
392 case M_P_B:
393 if (record->event.pressed) {
394 if (current_os == OS_WIN) {
395 SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_PAUSE) SS_UP(X_LGUI));
396 } else {
397 }
398 }
399 return false;
400
401 case M_C_A_D:
402 if (record->event.pressed) {
403 if (current_os == OS_WIN) {
404 SEND_STRING(SS_DOWN(X_LCTRL) SS_DOWN(X_LALT) SS_TAP(X_DELETE) SS_UP(X_LALT) SS_UP(X_LCTRL));
405 } else {
406 }
407 }
408 return false;
409
410 case M_CALC:
411 if (record->event.pressed) {
412 if (current_os == OS_WIN) {
413 SEND_STRING(SS_TAP(X_CALCULATOR));
414 } else if (current_os == OS_MAC) {
415 SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER));
416 }
417 }
418 return false;
419
420 case M_OS:
421 if (record->event.pressed) {
422 set_os((current_os+1) % _OS_COUNT, true);
423 }
424 return false;
425
426 case M_LOD:
427 if (record->event.pressed) {
428 send_unicode_hex_string("0CA0 005F 005F 0CA0");
429 }
430 return false;
431
432 case M_LENNY:
433 if (record->event.pressed) {
434 send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029");
435 }
436 return false;
437
438
439 case M_TF:
440 if (record->event.pressed) {
441 send_unicode_hex_string("0028 256F 2035 0414 2032 0029 256F 5F61 253B 2501 253B");
442 }
443 return false;
444
445 case M_UF:
446 if (record->event.pressed) {
447 send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029");
448 }
449 return false;
450
451 case M_SHRUG:
452 if (record->event.pressed) {
453 send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
454 }
455 return false;
456
457 case M_TM:
458 if (record->event.pressed) {
459 send_unicode_hex_string("2122");
460 }
461 return false;
462
463 case M_REPO:
464 if (record->event.pressed) {
465 SEND_STRING("https://github.com/arkag/qmk_firmware/tree/master/keyboards/mechmini/v2/keymaps/arkag");
466 }
467 return false;
468
469 case M_GGT:
470 if (record->event.pressed) {
471 SEND_STRING("@GrahamGoldenTech.com");
472 }
473 return false;
474
475 case M_SNIPT:
476 if (record->event.pressed) {
477 surround_type(6, KC_GRAVE, false);
478 pri_mod(true);
479 tap_key(KC_V);
480 pri_mod(false);
481 tap_key(KC_RGHT);
482 tap_key(KC_RGHT);
483 tap_key(KC_RGHT);
484 tap_key(KC_ENTER);
485 }
486 return false;
487
488 case M_BOLD:
489 if (record->event.pressed) {
490 surround_type(4, KC_8, true);
491 }
492 return false;
493
494 case M_ITAL:
495 if (record->event.pressed) {
496 surround_type(2, KC_8, true);
497 }
498 return false;
499
500 case M_ULIN:
501 if (record->event.pressed) {
502 surround_type(4, KC_MINS, true);
503 }
504 return false;
505
506 case KC_LSFT:
507 if (record->event.pressed) {
508 set_color(mod_color(underglow, true, 50), false);
509 SEND_STRING(SS_DOWN(X_LSHIFT));
510 } else {
511 set_color(underglow, false);
512 SEND_STRING(SS_UP(X_LSHIFT));
513 }
514 return false;
515
516 case MEDIA:
517 case LAZY:
518 case KEEB:
519 case RAISE:
520 case LOWER:
521 return true;
522
523 default:
524 if (record->event.pressed) {
525 active_timer_one = timer_read();
526 state = active;
527 }
528 return true;
529 }
530}
531
532uint32_t layer_state_set_user(uint32_t state) {
533 switch (biton32(state)) {
534 case _LAZY:
535 save_color(underglow);
536 underglow = mod_color(underglow, true, 50);
537 break;
538 case _MEDIA:
539 save_color(underglow);
540 underglow = mod_color(underglow, true, 150);
541 break;
542 case _KEEB:
543 save_color(underglow);
544 underglow = mod_color(underglow, false, 150);
545 break;
546 case _LOWER:
547 save_color(underglow);
548 underglow = mod_color(underglow, false, 100);
549 break;
550 case _RAISE:
551 save_color(underglow);
552 underglow = mod_color(underglow, true, 100);
553 break;
554 default:
555 reset_color();
556 break;
557 }
558 set_color(underglow, false);
559 return state;
560}
561
562//Tap Dance Definitions
563qk_tap_dance_action_t tap_dance_actions[] = {
564 [TD_3_GRV_ACT] = ACTION_TAP_DANCE_FN (dance_3),
565 [TD_C_CED] = ACTION_TAP_DANCE_FN (dance_c),
566 [TD_GRV_3GRV] = ACTION_TAP_DANCE_FN (dance_grv),
567 [TD_SING_DOUB] = ACTION_TAP_DANCE_FN (dance_quot),
568 [TD_STRK_SHOT] = ACTION_TAP_DANCE_FN (dance_strk),
569 [TD_HYPH_UNDR] = ACTION_TAP_DANCE_DOUBLE (KC_MINS, LSFT(KC_MINS)),
570 [TD_BRCK_PARN_O] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, LSFT(KC_9)),
571 [TD_BRCK_PARN_C] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, LSFT(KC_0)),
572 [TD_LALT_RALT] = ACTION_TAP_DANCE_DOUBLE (KC_LALT, KC_RALT),
573};
diff --git a/users/arkag/arkag.h b/users/arkag/arkag.h
new file mode 100644
index 000000000..9c81e4487
--- /dev/null
+++ b/users/arkag/arkag.h
@@ -0,0 +1,161 @@
1#pragma once
2
3#include "quantum.h"
4#include "process_keycode/process_tap_dance.h"
5
6#define EECONFIG_USERSPACE (uint8_t *)20
7
8#define LRALT TD(TD_LALT_RALT)
9#define QUOTE TD(TD_SING_DOUB)
10#define GRAVE TD(TD_GRV_3GRV)
11#define OBRACK TD(TD_BRCK_PARN_O)
12#define CBRACK TD(TD_BRCK_PARN_C)
13#define THREE TD(TD_3_GRV_ACT)
14#define STRIKE TD(TD_STRK_SHOT)
15#define HYPHEN TD(TD_HYPH_UNDR)
16#define CEDILLA TD(TD_C_CED)
17
18#define RAISE MO(1)
19#define LOWER MO(2)
20#define KEEB MO(3)
21#define MEDIA MO(4)
22#define LAZY MO(5)
23
24#define MOD_CTL_MASK (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))
25#define MOD_GUI_MASK (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI))
26#define MOD_SFT_MASK (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))
27
28#define TAP_A LALT_T(KC_A)
29#define TAP_SCN RALT_T(KC_SCOLON)
30
31#define TAP_S LCTL_T(KC_S)
32#define TAP_L RCTL_T(KC_L)
33
34#define TAP_D LSFT_T(KC_D)
35#define TAP_K RSFT_T(KC_K)
36
37#define TAP_F LGUI_T(KC_F)
38#define TAP_J RGUI_T(KC_J)
39
40#define TAP_EQ LSFT_T(KC_EQUAL)
41#define TAP_5 RSFT_T(KC_5)
42
43#define LED_FLASH_DELAY 150
44#define LED_FADE_DELAY 10
45
46#define INACTIVE_DELAY 200
47#define SLEEP_DELAY 60000
48
49enum {
50 _QWERTY = 0,
51 _RAISE,
52 _LOWER,
53 _KEEB,
54 _MEDIA,
55 _LAZY,
56};
57
58typedef enum {
59 OS_MAC, // Don't assign values
60 OS_WIN,
61 OS_NIX,
62 _OS_COUNT,
63} OS;
64
65typedef struct {
66 uint16_t h;
67 uint8_t s;
68 uint8_t v;
69} Color;
70
71typedef enum {
72 no_flash = 0,
73 flash_off,
74 flash_on,
75} flashState;
76
77typedef enum {
78 add_fade = 0,
79 sub_fade,
80} fadeState;
81
82typedef enum {
83 active = 0,
84 inactive,
85 sleeping,
86 boot,
87} activityState;
88
89enum custom_keycodes {
90 M_PMOD = SAFE_RANGE,
91 M_SMOD,
92 M_P_B,
93 M_C_A_D,
94 M_CALC,
95 M_OS,
96 M_TF,
97 M_TM,
98 M_GGT,
99 M_LOD,
100 M_LENNY,
101 M_BOLD,
102 M_ITAL,
103 M_ULIN,
104 M_SNIPT,
105 M_REPO,
106 M_SHRUG,
107 M_UF,
108};
109
110enum tapdances {
111 TD_3_GRV_ACT = 0,
112 TD_C_CED,
113 TD_GRV_3GRV,
114 TD_SLSH_HTTP,
115 TD_SING_DOUB,
116 TD_HYPH_UNDR,
117 TD_STRK_SHOT,
118 TD_SPECIAL,
119 TD_BRCK_PARN_O,
120 TD_BRCK_PARN_C,
121 TD_LALT_RALT,
122 SPC_SFT_NSFT,
123};
124
125void send_unicode_hex_string(const char *str);
126
127void set_color (Color new, bool update);
128void save_color(Color to_save);
129void reset_color(void);
130
131Color mod_color(Color current_color, bool should_add, uint8_t change_amount);
132
133void reverse_fade (void);
134
135void check_state (void);
136
137void fade_rgb (void);
138
139void flash_rgb (void);
140
141void set_os (uint8_t os, bool update);
142
143void tap_key(uint8_t keycode);
144
145void pri_mod(bool press);
146
147void sec_mod(bool press);
148
149void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift);
150
151void long_keystroke(size_t num_of_keys, uint16_t keys[]);
152
153void dance_grv (qk_tap_dance_state_t *state, void *user_data);
154void dance_quot (qk_tap_dance_state_t *state, void *user_data);
155void dance_strk (qk_tap_dance_state_t *state, void *user_data);
156void dance_3 (qk_tap_dance_state_t *state, void *user_data);
157void dance_c (qk_tap_dance_state_t *state, void *user_data);
158
159int cur_dance (qk_tap_dance_state_t *state);
160void spc_finished (qk_tap_dance_state_t *state, void *user_data);
161void spc_reset (qk_tap_dance_state_t *state, void *user_data);
diff --git a/users/arkag/config.h b/users/arkag/config.h
new file mode 100644
index 000000000..e715e5534
--- /dev/null
+++ b/users/arkag/config.h
@@ -0,0 +1,5 @@
1#pragma once
2
3#define TAPPING_TERM 200
4
5#define IGNORE_MOD_TAP_INTERRUPT
diff --git a/users/arkag/readme.md b/users/arkag/readme.md
new file mode 100644
index 000000000..76a5c4525
--- /dev/null
+++ b/users/arkag/readme.md
@@ -0,0 +1,14 @@
1Copyright 2018 arkag arkag@pm.me
2
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/users/arkag/rules.mk b/users/arkag/rules.mk
new file mode 100644
index 000000000..3513f0ea6
--- /dev/null
+++ b/users/arkag/rules.mk
@@ -0,0 +1 @@
SRC += arkag.c