From 1bb77c087502de19fe5e403f519be321ba2c85f5 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 20 Apr 2018 17:53:19 -0700 Subject: Update to drashna keymaps and userspace (#2756) * Re-add NO_SECRETS option * Add Thumb Clusters defines for default layout * Minor tweaks * More Minor tweaks * Revert Orthodox layers and move function keys around * Fix keymap so it will compile under the Infinity Since I haven't added 'pretty' layouts to it yet * Cleanup of userspace * Cleanup keymaps * OMG fix Workman * Move mods layer key around * Reduce debounce in Ergodox EZ * Fix Infinity layers * Add list of pins used by Ergdox EZ for easy reference * Revert "Reduce debounce in Ergodox EZ" This reverts commit 8a3db2673b419ef8032c40a6d29156cef632f9cd. * Add Clicky toggle to Orthodox * Fix Audio Clicky keycode * Enable Faux Clicky by default * Add Unicode stuff --- users/drashna/drashna.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) (limited to 'users/drashna/drashna.c') diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 73bd249e4c..d9d412b086 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 float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes #endif // FAUXCLICKY_ENABLE +float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); + + bool faux_click_enabled = false; bool is_overwatch = false; +static uint16_t copy_paste_timer; #ifdef RGBLIGHT_ENABLE bool rgb_layer_change = true; #endif @@ -198,17 +203,21 @@ void matrix_scan_user(void) { matrix_scan_keymap(); } +void tap(uint16_t keycode){ + register_code(keycode); + unregister_code(keycode); +}; + // This block is for all of the gaming macros, as they were all doing // the same thing, but with differring text sent. bool send_game_macro(const char *str, keyrecord_t *record, bool override) { if (!record->event.pressed || override) { clear_keyboard(); - register_code(is_overwatch ? KC_BSPC : KC_ENTER); - unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); + tap(is_overwatch ? KC_BSPC : KC_ENTER); wait_ms(50); send_string(str); - register_code(KC_ENTER); - unregister_code(KC_ENTER); + wait_ms(50); + tap(KC_ENTER); } if (override) wait_ms(3000); return false; @@ -402,6 +411,56 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; break; #endif // RGBLIGHT_ENABLE + + + case KC_CCCV: // One key copy/paste + if(record->event.pressed){ + copy_paste_timer = timer_read(); + } else { + if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy + register_code(KC_LCTL); + tap(KC_C); + unregister_code(KC_LCTL); +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_copy); +#endif + } else { // Tap, paste + register_code(KC_LCTL); + tap(KC_V); + unregister_code(KC_LCTL); +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_paste); +#endif + } + } + return false; + break; + +#ifdef UNICODE_ENABLE + case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ + if (record->event.pressed) { + register_code(KC_RSFT); + tap(KC_9); + unregister_code(KC_RSFT); + process_unicode((0x256F | QK_UNICODE), record); // Arm + process_unicode((0x00B0 | QK_UNICODE), record); // Eye + process_unicode((0x25A1 | QK_UNICODE), record); // Mouth + process_unicode((0x00B0 | QK_UNICODE), record); // Eye + register_code(KC_RSFT); + tap(KC_0); + unregister_code(KC_RSFT); + process_unicode((0x256F | QK_UNICODE), record); // Arm + tap(KC_SPC); + process_unicode((0x0361 | QK_UNICODE), record); // Flippy + tap(KC_SPC); + process_unicode((0x253B | QK_UNICODE), record); // Table + process_unicode((0x2501 | QK_UNICODE), record); // Table + process_unicode((0x253B | QK_UNICODE), record); // Table + } + return false; + break; +#endif // UNICODE_ENABLE + } return process_record_keymap(keycode, record); } @@ -413,6 +472,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { uint32_t layer_state_set_user(uint32_t state) { #ifdef RGBLIGHT_ENABLE uint8_t default_layer = eeconfig_read_default_layer(); + if (rgb_layer_change) { switch (biton32(state)) { case _NAV: -- cgit v1.2.3