diff options
author | rupa <rdeadwyler@ns1.com> | 2020-11-10 00:04:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 16:04:46 +1100 |
commit | a9f65b760a49744b13d822ab359876a52779bd9e (patch) | |
tree | f5e64f0d55df4f170e05f5f9d26218388102e628 /users/rupa/process_records.c | |
parent | 53f11668a3399ff1bdf82902a7717832831219bf (diff) | |
download | qmk_firmware-a9f65b760a49744b13d822ab359876a52779bd9e.tar.gz qmk_firmware-a9f65b760a49744b13d822ab359876a52779bd9e.zip |
userspace and keymap changes for rupa (#10489)
* userspace and keymap changes for rupa
* remove layout wrappers and blocker rows from wrappers
handle this in keymaps for now
Diffstat (limited to 'users/rupa/process_records.c')
-rw-r--r--[-rwxr-xr-x] | users/rupa/process_records.c | 118 |
1 files changed, 82 insertions, 36 deletions
diff --git a/users/rupa/process_records.c b/users/rupa/process_records.c index 2d72310100..2d23e34017 100755..100644 --- a/users/rupa/process_records.c +++ b/users/rupa/process_records.c @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "rupa.h" -font_t *translator = NULL; +uint16_t processed_keycode; __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { @@ -25,47 +25,93 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - bool is_shifted = get_mods()&MOD_MASK_SHIFT; - bool is_pressed = record->event.pressed; + if (record->event.pressed) { - switch(keycode) { - case VRSN: - if (is_pressed) { + processed_keycode = keycode; + // mask out mod taps + if ( + (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || + (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) + ) { + processed_keycode &= 0xFF; + } + + bool is_shifted = (get_mods() | get_oneshot_mods() | get_weak_mods()) & MOD_MASK_SHIFT; + switch(processed_keycode) { + case VRSN: send_string_with_delay_P(PSTR( - "# " QMK_KEYBOARD "/" QMK_KEYMAP ":" QMK_VERSION " " QMK_BUILDDATE "\n" + "# " QMK_KEYBOARD "/" QMK_KEYMAP ":" QMK_VERSION " " QMK_BUILDDATE "\n" ), TAP_CODE_DELAY); - } - return false; + return false; - case LOD: - case RUPA: - if (is_pressed) { - if (keycode == LOD) { - send_unicode_string((is_shifted ? "¯\\_(ツ)_/¯" : "ಠ_ಠ")); - } else if (keycode == RUPA) { - send_unicode_string((is_shifted ? "Śrīrūpa" : "rūpa")); - } - } - return false; + case BUGS: + return u_xp(is_shifted, "ᙙᙖ", "ଳ"); + case CATS: + return u_xp(is_shifted, "ⓛ ᆽ ⓛ ", "ㅇㅅㅇ"); + case DANCE: + return u_x(dance(is_shifted)); + case DICE: + return u_x(d6()); + case DOMO: + return u_xp(is_shifted, "(シ_ _)シ", "m(_ _)m"); + case FART: + return u_x("⊥ʶ∀Ⅎ"); + case FLIP: + return u_x(flip(is_shifted)); + case HUGS: + return u_xp(is_shifted, "(づ ̄ ³ ̄)づ", "(っಠ‿ಠ)っ"); + case JOY: + return u_x(joy(is_shifted)); + case RNDM: + return false; + case KISS: + return u_xp(is_shifted, "꒒ ০ ⌵ ୧ ♡", "( ˘ ³˘)♥"); + case LOD: + return u_xp(is_shifted, "( ͡ಠ ʖ̯ ͡ಠ)", "ಠ_ಠ"); + case MUSIC: + return u_xp(is_shifted, "(˳˘ ɜ˘)˳ ♬ ♪♫", "(´▽`)ノ♫"); + case RUPA: + return u_xp(is_shifted, "Śrīrūpa", "rūpa"); + case SHRUG: + return u_xp(is_shifted, "⋌ ༼ •̀ ⌂ •́ ༽⋋", "¯\\_(ツ)_/¯"); + case TADA: + return u_xp(is_shifted, "☆ *・゜゚・*(^O^)/*・゜゚・*☆", "\\(゜ロ\\)Ξ(//ロ゜)//"); + case WAT: + return u_xp(is_shifted, "༼ ຶཽཀ ຶཽ༽", "ヽ༼⊙_⊙༽ノ"); + case YUNO: + return u_xp(is_shifted, "o(^^o)", "щ(゜ロ゜щ)"); + case ZALGO: + set_combined_mode(CM_ZALGO); + break; + case ZZZZZ: + cycle_combined_mode(); + break; - // script modes - case U_FRACT: - case U_MONOS: - case U_SCRPT: - if (is_pressed) { - if (keycode == U_SCRPT) { - translator = (translator == &script_bold ? NULL : &script_bold); - } else if (keycode == U_FRACT) { - translator = (translator == &fraktu_bold ? NULL : &fraktu_bold); - } else if (keycode == U_MONOS) { - translator = (translator == &monosp_bold ? NULL : &monosp_bold); - } - } - return true; +#if defined(UNICODE_SCRIPT_MODE_ENABLE) + // script modes + case U_FRACT: + return set_script_mode(F_FRACT); + case U_ITALI: + return set_script_mode(F_ITALI); + case U_MONOS: + return set_script_mode(F_MONOS); + case U_NORML: + return set_script_mode(F_NORML); + case U_SANSI: + return set_script_mode(F_SANSI); + case U_SANSN: + return set_script_mode(F_SANSN); + case U_SCRPT: + return set_script_mode(F_SCRPT); - default: - if (is_pressed && translator != NULL) { - return script_mode_translate(translator, is_shifted, keycode); + default: + if (get_script_mode() != NULL) { + return script_mode_translate(is_shifted, processed_keycode); + } + if (combined_mode != CM_NULL && combined_text(processed_keycode)) { + return false; + } +#endif } } return process_record_keymap(keycode, record); |