1 // Written by konstantin: vomindoraan
2 #include "send_unicode.h"
7 void send_unicode_hex_string(const char* str) {
8 if (!str) { return; } // Safety net
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
15 strncpy(code_point, str, n);
16 code_point[n] = '\0'; // Make sure it's null-terminated
18 // Normalize the code point: make all hex digits lowercase
19 for (char *p = code_point; *p; p++) {
20 *p = tolower((unsigned char)*p);
23 // Send the code point as a Unicode input string
24 unicode_input_start();
25 send_string(code_point);
26 unicode_input_finish();
28 str += n; // Move to the first ' ' (or '\0') after the current token
33 // send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
38 register_code(KC_RSFT);
40 unregister_code(KC_RSFT);
41 process_unicode((0x256F | QK_UNICODE), record); // Arm
42 process_unicode((0x00B0 | QK_UNICODE), record); // Eye
43 process_unicode((0x25A1 | QK_UNICODE), record); // Mouth
44 process_unicode((0x00B0 | QK_UNICODE), record); // Eye
45 register_code(KC_RSFT);
47 unregister_code(KC_RSFT);
48 process_unicode((0x256F | QK_UNICODE), record); // Arm
50 process_unicode((0x0361 | QK_UNICODE), record); // Flippy
52 process_unicode((0x253B | QK_UNICODE), record); // Table
53 process_unicode((0x2501 | QK_UNICODE), record); // Table
54 process_unicode((0x253B | QK_UNICODE), record); // Table
58 // If you need a good converter: https://r12a.github.io/app-conversion/
61 void unicode_input_start (void) {
63 saved_mods = get_mods(); // Save current mods
64 clear_mods(); // Unregister mods to start from a clean state
66 switch(get_unicode_input_mode()) {
68 register_code(KC_LALT);
71 register_code(KC_LCTL);
72 register_code(KC_LSFT);
74 unregister_code(KC_U);
75 unregister_code(KC_LSFT);
76 unregister_code(KC_LCTL);
79 register_code(KC_LALT);
80 register_code(KC_PPLS);
81 unregister_code(KC_PPLS);
84 register_code(KC_RALT);
85 unregister_code(KC_RALT);
87 unregister_code(KC_U);
90 wait_ms(UNICODE_TYPE_DELAY);
93 void unicode_input_finish (void) {
94 switch(get_unicode_input_mode()) {
97 unregister_code(KC_LALT);
100 register_code(KC_SPC);
101 unregister_code(KC_SPC);
105 set_mods(saved_mods); // Reregister previously set mods