summaryrefslogtreecommitdiff
path: root/users/drashna/keyrecords/unicode.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/keyrecords/unicode.c')
-rw-r--r--users/drashna/keyrecords/unicode.c128
1 files changed, 112 insertions, 16 deletions
diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c
index 753fca3231..16390074ca 100644
--- a/users/drashna/keyrecords/unicode.c
+++ b/users/drashna/keyrecords/unicode.c
@@ -7,7 +7,18 @@
#include "unicode.h"
#include "process_unicode_common.h"
-uint8_t typing_mode = UCTM_NO_MODE;
+uint8_t unicode_typing_mode = UCTM_NO_MODE;
+const char unicode_mode_str[UNCODES_MODE_END][13] PROGMEM = {
+ " Normal\0",
+ " Wide\0",
+ " Script\0",
+ " Blocks\0",
+ " Regional\0",
+ " Aussie\0",
+ " Zalgo\0",
+ "Super Script\0",
+ " Comic\0",
+};
/**
* @brief Registers the unicode keystrokes based on desired unicode
@@ -91,6 +102,45 @@ DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_script, 0x1D4EA, 0x1D4D
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_boxes, 0x1F170, 0x1F170, '0', '1', 0x2002);
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_regional, 0x1F1E6, 0x1F1E6, '0', '1', 0x2003);
+// DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_normal,
+// 'a', // a
+// 'b', // b
+// 'c', // c
+// 'd', // d
+// 'e', // e
+// 'f', // f
+// 'g', // g
+// 'h', // h
+// 'i', // i
+// 'j', // j
+// 'k', // k
+// 'l', // l
+// 'm', // m
+// 'n', // n
+// 'o', // o
+// 'p', // p
+// 'q', // q
+// 'r', // r
+// 's', // s
+// 't', // t
+// 'u', // u
+// 'v', // v
+// 'w', // w
+// 'x', // x
+// 'y', // y
+// 'z', // z
+// '1', // 1
+// '2', // 2
+// '3', // 3
+// '4', // 4
+// '5', // 5
+// '6', // 6
+// '7', // 7
+// '8', // 8
+// '9', // 9
+// '0' // 0
+// );
+
DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_aussie,
0x0250, // a
'q', // b
@@ -169,6 +219,45 @@ DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_super,
0x2070 // 0
);
+DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_comic,
+ 0x212B, // a
+ 0x212C, // b
+ 0x2102, // c
+ 0x2145, // d
+ 0x2107, // e
+ 0x2132, // f
+ 0x2141, // g
+ 0x210D, // h
+ 0x2148, // i
+ 0x2111, // j
+ 'k', // k
+ 0x2143, // l
+ 'm', // m
+ 0x2115, // n
+ 0x2134, // o
+ 0x2119, // p
+ 0x211A, // q
+ 0x211B, // r
+ 0x20B7, // s
+ 0x20B8, // t
+ 0x2127, // u
+ 'v', // v
+ 0x20A9, // w
+ 'x', // x
+ 0x213D, // y
+ 'z', // z
+ '1', // 1
+ '2', // 2
+ '3', // 3
+ '4', // 4
+ '5', // 5
+ '6', // 6
+ '7', // 7
+ '8', // 8
+ '9', // 9
+ '0' // 0
+);
+
bool process_record_aussie(uint16_t keycode, keyrecord_t *record) {
bool is_shifted = (get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT;
if ((KC_A <= keycode) && (keycode <= KC_0)) {
@@ -280,12 +369,12 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
register_unicode(0x203D);
}
break;
- case KC_NOMODE ... KC_SUPER:
+ case KC_NOMODE ... KC_COMIC:
if (record->event.pressed) {
- if (typing_mode != keycode - KC_NOMODE) {
- typing_mode = keycode - KC_NOMODE;
+ if (unicode_typing_mode != keycode - KC_NOMODE) {
+ unicode_typing_mode = keycode - KC_NOMODE;
} else {
- typing_mode = UCTM_NO_MODE;
+ unicode_typing_mode = UCTM_NO_MODE;
}
}
break;
@@ -295,23 +384,26 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
return true;
}
- if (((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) && record->tap.count) {
- keycode &= 0xFF;
+ if (IS_QK_MOD_TAP(keycode) && record->tap.count) {
+ keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
+ }
+ if (IS_QK_LAYER_TAP(keycode) && record->tap.count) {
+ keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
}
- if (typing_mode == UCTM_WIDE) {
+ if (unicode_typing_mode == UCTM_WIDE) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
return process_record_glyph_replacement(keycode, record, unicode_range_translator_wide);
}
- } else if (typing_mode == UCTM_SCRIPT) {
+ } else if (unicode_typing_mode == UCTM_SCRIPT) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
return process_record_glyph_replacement(keycode, record, unicode_range_translator_script);
}
- } else if (typing_mode == UCTM_BLOCKS) {
+ } else if (unicode_typing_mode == UCTM_BLOCKS) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
return process_record_glyph_replacement(keycode, record, unicode_range_translator_boxes);
}
- } else if (typing_mode == UCTM_REGIONAL) {
+ } else if (unicode_typing_mode == UCTM_REGIONAL) {
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
if (!process_record_glyph_replacement(keycode, record, unicode_range_translator_regional)) {
wait_us(500);
@@ -319,22 +411,26 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
return false;
}
}
- } else if (typing_mode == UCTM_SUPER) {
+ } else if (unicode_typing_mode == UCTM_SUPER) {
if (((KC_A <= keycode) && (keycode <= KC_0))) {
return process_record_glyph_replacement(keycode, record, unicode_lut_translator_super);
}
- } else if (typing_mode == UCTM_AUSSIE) {
+ } else if (unicode_typing_mode == UCTM_COMIC) {
+ if (((KC_A <= keycode) && (keycode <= KC_0))) {
+ return process_record_glyph_replacement(keycode, record, unicode_lut_translator_comic);
+ }
+ } else if (unicode_typing_mode == UCTM_AUSSIE) {
return process_record_aussie(keycode, record);
- } else if (typing_mode == UCTM_ZALGO) {
+ } else if (unicode_typing_mode == UCTM_ZALGO) {
return process_record_zalgo(keycode, record);
}
return true;
}
/**
- * @brief Initialize the default unicode mode on firmware startu
+ * @brief Initialize the default unicode mode on firmware startup
*
*/
-void matrix_init_unicode(void) {
+void keyboard_post_init_unicode(void) {
unicode_input_mode_init();
}