New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbolic Unicode Input System #635

merged 8 commits into from Aug 15, 2016


None yet
2 participants

algernon commented Aug 15, 2016


The purpose of this feature is to allow the person in front of the keyboard to enter Unicode symbols by name. Once the keymap is modified to call qk_ucis_start()', whenever that action is triggered, we will cache the next few chars (up to 32 by default), and if any ofEnter,SpaceorESCare pressed, we delete everything back. UnlessESC` was pressed, we then look up the string entered so far, and compare it to a dictionary. If found, we enter the code associated with the string, otherwise we replay the keys. During the input process, backspace will delete the previous character (holding it likely doesn't work, mind you).

The feature is disabled by default, and should not increase the firmware size if left disabled. If enabled, it also enables unicode input.


So, to give a minimal example, here is how to use this feature:

  • Add UCIS_ENABLE = yes to your keymaps Makefile.
  • Create a macro, or a leader-key sequence or similar that will call qk_ucis_start().
  • Create a lookup table like this:
const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
 UCIS_SYM("poop", 0x1f4a9),
 UCIS_SYM("rofl", 0x1f923),
 UCIS_SYM("kiss", 0x1f619),
 UCIS_SYM("snowman", 0x2603),
 UCIS_SYM("coffee", 0x2615),
 UCIS_SYM("heart", 0x2764)

Recompile the firmware, and press your trigger combo, and type snowman, followed by Enter or Space. If all goes well, the text you entered should be replaced by the snowman symbol.


Known issues

I have only tested this on Linux, it may or may not work elsewhere. Replaying keycodes is not the best implementation, as it can only replay the 8bit keycodes. This was easy to implement, but its not a 100% accurate playback. In most cases, that should not be a problem, I believe.

I've been using this for the past 3 days, and the latest variant for a couple of hours, and so far I did not manage to break it yet. At least not in ways I wasn't expecting.

algernon added some commits Aug 13, 2016

process_unicode: Small refactor & linux fix
This moves the unicode input start / end sequences into their own
functions, so keymaps and other functionality can build on it too.

At the same time, it changes how the Linux variant works, to match
reality: CTRL+SHIFT must be unregistered too, and we close the thing
with a Space instead.

Signed-off-by: Gergely Nagy <>
process_unicode: Add a way to enter unicode symbols by name
The purpose of this change is to allow keymaps to specify a dictionary
of unicode symbol name to code mappings, and let the person at the
keyboard enter unicode symbols by name.

This is done by having a way to trigger unicode symbol input mode, when
all keys are cached until Esc, Enter or Space are pressed. Once that
happens, we try to look up the symbol from our lookup table. If found,
we erase back, and type the unicode magic in to get that symbol. If not
found, we still erase back, start unicode input mode, and replay what
the user typed in.

Signed-off-by: Gergely Nagy <>
process_unicode: Handle too long UCIS symbol names
If the symbol name being entered is longer than the max, stop recording
it, and stop processing keycodes apart from the ones that can delete,
finish or cancel the sequence.

Signed-off-by: Gergely Nagy <>
process_unicode: Call process_ucis() automatically
If UCIS is enabled, call process_ucis() automatically from

Signed-off-by: Gergely Nagy <>
process_unicode: Make the startup overridable
Extract out the part of `qk_ucis_start` that inputs the placeholder
symbol, and make it weak, so it can be overridden.

Signed-off-by: Gergely Nagy <>
process_unicode: Use uint32_t for UCIS purposes
Use a single uint32_t to store the unicode of a symbol, instead of an
array of uint16_ts.

Signed-off-by: Gergely Nagy <>
process_unicode: Replace register_hex32
It turns out that register_hex32 did not work reliably, and some systems
only allow 7 chars after the unicode magic sequence, while others allow
8. To remedy the situation, store the codes as strings, and type those
in instead of doing bit shifting magic.

Signed-off-by: Gergely Nagy <>
process_unicode: Introduce a slight delay
When entering unicode codes, use some delay, so the OS has time to
process the information. This is not needed on all systems, but some
seem to require it.

Signed-off-by: Gergely Nagy <>

This comment has been minimized.

Show comment
Hide comment

jackhumbert Aug 15, 2016


This is awesome! :D


jackhumbert commented Aug 15, 2016

This is awesome! :D

@jackhumbert jackhumbert merged commit cc7acfb into qmk:master Aug 15, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@algernon algernon deleted the algernon:f/ucis branch Aug 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment