aboutsummaryrefslogtreecommitdiff
path: root/users/drashna/send_unicode.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/send_unicode.c')
-rw-r--r--users/drashna/send_unicode.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/users/drashna/send_unicode.c b/users/drashna/send_unicode.c
index cacfe1dc8..ff35368da 100644
--- a/users/drashna/send_unicode.c
+++ b/users/drashna/send_unicode.c
@@ -56,3 +56,57 @@ void send_unicode_hex_string(const char* str) {
56 56
57 57
58// If you need a good converter: https://r12a.github.io/app-conversion/ 58// If you need a good converter: https://r12a.github.io/app-conversion/
59uint8_t saved_mods;
60
61void unicode_input_start (void) {
62 // save current mods
63 saved_mods = get_mods(); // Save current mods
64 clear_mods(); // Unregister mods to start from a clean state
65
66 switch(get_unicode_input_mode()) {
67 case UC_OSX:
68 register_code(KC_LALT);
69 break;
70 case UC_OSX_RALT:
71 register_code(KC_RALT);
72 break;
73 case UC_LNX:
74 register_code(KC_LCTL);
75 register_code(KC_LSFT);
76 register_code(KC_U);
77 unregister_code(KC_U);
78 unregister_code(KC_LSFT);
79 unregister_code(KC_LCTL);
80 break;
81 case UC_WIN:
82 register_code(KC_LALT);
83 register_code(KC_PPLS);
84 unregister_code(KC_PPLS);
85 break;
86 case UC_WINC:
87 register_code(KC_RALT);
88 unregister_code(KC_RALT);
89 register_code(KC_U);
90 unregister_code(KC_U);
91 break;
92 }
93 wait_ms(UNICODE_TYPE_DELAY);
94}
95
96void unicode_input_finish (void) {
97 switch(get_unicode_input_mode()) {
98 case UC_OSX:
99 case UC_WIN:
100 unregister_code(KC_LALT);
101 break;
102 case UC_OSX_RALT:
103 unregister_code(KC_RALT);
104 break;
105 case UC_LNX:
106 register_code(KC_SPC);
107 unregister_code(KC_SPC);
108 break;
109 }
110
111 set_mods(saved_mods); // Reregister previously set mods
112}