aboutsummaryrefslogtreecommitdiff
path: root/users/drashna/drashna.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/drashna.c')
-rw-r--r--users/drashna/drashna.c68
1 files changed, 64 insertions, 4 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 73bd249e4..d9d412b08 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -41,8 +41,13 @@ float fauxclicky_pressed[][2] = SONG(S__NOTE(_A6)); // change to you
41float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes 41float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes
42#endif // FAUXCLICKY_ENABLE 42#endif // FAUXCLICKY_ENABLE
43 43
44float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
45float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
46
47
44bool faux_click_enabled = false; 48bool faux_click_enabled = false;
45bool is_overwatch = false; 49bool is_overwatch = false;
50static uint16_t copy_paste_timer;
46#ifdef RGBLIGHT_ENABLE 51#ifdef RGBLIGHT_ENABLE
47bool rgb_layer_change = true; 52bool rgb_layer_change = true;
48#endif 53#endif
@@ -198,17 +203,21 @@ void matrix_scan_user(void) {
198 matrix_scan_keymap(); 203 matrix_scan_keymap();
199} 204}
200 205
206void tap(uint16_t keycode){
207 register_code(keycode);
208 unregister_code(keycode);
209};
210
201// This block is for all of the gaming macros, as they were all doing 211// This block is for all of the gaming macros, as they were all doing
202// the same thing, but with differring text sent. 212// the same thing, but with differring text sent.
203bool send_game_macro(const char *str, keyrecord_t *record, bool override) { 213bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
204 if (!record->event.pressed || override) { 214 if (!record->event.pressed || override) {
205 clear_keyboard(); 215 clear_keyboard();
206 register_code(is_overwatch ? KC_BSPC : KC_ENTER); 216 tap(is_overwatch ? KC_BSPC : KC_ENTER);
207 unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
208 wait_ms(50); 217 wait_ms(50);
209 send_string(str); 218 send_string(str);
210 register_code(KC_ENTER); 219 wait_ms(50);
211 unregister_code(KC_ENTER); 220 tap(KC_ENTER);
212 } 221 }
213 if (override) wait_ms(3000); 222 if (override) wait_ms(3000);
214 return false; 223 return false;
@@ -402,6 +411,56 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
402 } 411 }
403 return true; break; 412 return true; break;
404#endif // RGBLIGHT_ENABLE 413#endif // RGBLIGHT_ENABLE
414
415
416 case KC_CCCV: // One key copy/paste
417 if(record->event.pressed){
418 copy_paste_timer = timer_read();
419 } else {
420 if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
421 register_code(KC_LCTL);
422 tap(KC_C);
423 unregister_code(KC_LCTL);
424#ifdef AUDIO_ENABLE
425 PLAY_SONG(tone_copy);
426#endif
427 } else { // Tap, paste
428 register_code(KC_LCTL);
429 tap(KC_V);
430 unregister_code(KC_LCTL);
431#ifdef AUDIO_ENABLE
432 PLAY_SONG(tone_paste);
433#endif
434 }
435 }
436 return false;
437 break;
438
439#ifdef UNICODE_ENABLE
440 case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻
441 if (record->event.pressed) {
442 register_code(KC_RSFT);
443 tap(KC_9);
444 unregister_code(KC_RSFT);
445 process_unicode((0x256F | QK_UNICODE), record); // Arm
446 process_unicode((0x00B0 | QK_UNICODE), record); // Eye
447 process_unicode((0x25A1 | QK_UNICODE), record); // Mouth
448 process_unicode((0x00B0 | QK_UNICODE), record); // Eye
449 register_code(KC_RSFT);
450 tap(KC_0);
451 unregister_code(KC_RSFT);
452 process_unicode((0x256F | QK_UNICODE), record); // Arm
453 tap(KC_SPC);
454 process_unicode((0x0361 | QK_UNICODE), record); // Flippy
455 tap(KC_SPC);
456 process_unicode((0x253B | QK_UNICODE), record); // Table
457 process_unicode((0x2501 | QK_UNICODE), record); // Table
458 process_unicode((0x253B | QK_UNICODE), record); // Table
459 }
460 return false;
461 break;
462#endif // UNICODE_ENABLE
463
405 } 464 }
406 return process_record_keymap(keycode, record); 465 return process_record_keymap(keycode, record);
407} 466}
@@ -413,6 +472,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
413uint32_t layer_state_set_user(uint32_t state) { 472uint32_t layer_state_set_user(uint32_t state) {
414#ifdef RGBLIGHT_ENABLE 473#ifdef RGBLIGHT_ENABLE
415 uint8_t default_layer = eeconfig_read_default_layer(); 474 uint8_t default_layer = eeconfig_read_default_layer();
475
416 if (rgb_layer_change) { 476 if (rgb_layer_change) {
417 switch (biton32(state)) { 477 switch (biton32(state)) {
418 case _NAV: 478 case _NAV: