Skip to content

Add Unicode keycode support via UC() and UM() macros#328

Open
nkanellopoulos wants to merge 3 commits intothe-via:mainfrom
nkanellopoulos:feature/unicode-keycode-support
Open

Add Unicode keycode support via UC() and UM() macros#328
nkanellopoulos wants to merge 3 commits intothe-via:mainfrom
nkanellopoulos:feature/unicode-keycode-support

Conversation

@nkanellopoulos
Copy link
Copy Markdown

@nkanellopoulos nkanellopoulos commented May 30, 2025

See Unicode.md for the full docs.

Add support for QMK's Unicode keycodes using the UC() macro syntax.
Users can now enter Unicode characters through the Any keycode modal.

PREREQUISITES:
This has to be enabled in the keyboard's firmware

You can easily add it yourself to the firmware:

In keyboard's config.h:
define UNICODE_SELECTED_MODES UNICODE_MODE_MACOS

adjust for your system:

  • UNICODE_MODE_LINUX
  • UNICODE_MODE_MACOS
  • UNICODE_MODE_WINCOMPOSE

In rules.mk:
UNICODE_ENABLE = yes (the file for my keyboard is: keyboards/lemokey/l3/rules.mk)

Note: for this to work on macOS, the Unicode Hex Input source has to be active

Supported formats:

  • UC(0x00E4) - with 0x prefix
  • UC(00E4) - without 0x prefix

The implementation:

  • Parses UC(hex) syntax in the custom keycode modal
  • Validates hex codes are within QMK's supported range (0x0000-0x7FFF)
  • Converts to QMK Unicode keycode format (0x8000 | codepoint)
  • Displays keycodes back in UC() format for clarity

Example usage:

  • UC(0x00E4) for ä
  • UC(0x2764) for ❤
  • UC(0x03B1) for α

  Add support for QMK's Unicode keycodes using the UC() macro syntax.
  Users can now enter Unicode characters through the "Any" keycode modal.

  Supported formats:
  - UC(0x00E4) - with 0x prefix
  - UC(00E4) - without 0x prefix

  The implementation:
  - Parses UC(hex) syntax in the custom keycode modal
  - Validates hex codes are within QMK's supported range (0x0000-0x7FFF)
  - Converts to QMK Unicode keycode format (0x8000 | codepoint)
  - Displays keycodes back in UC() format for clarity

  Example usage:
  - UC(0x00E4) for ä
  - UC(0x2764) for ❤
  - UC(0x03B1) for α
Add support for QMK's Unicode Map keycodes to access the full Unicode range.

Supported formats:
- UM(index) - Unicode Map array index (0-16383)
  Allows access to full Unicode range including emoji
- UP(i, j) - Unicode Pair for lowercase/uppercase (0-127 each)
  Automatically switches based on Shift/Caps Lock state

Implementation:
- Parse UM(index) syntax and convert to QK_UNICODEMAP format
- Parse UP(i,j) syntax and convert to QK_UNICODEMAP_PAIR format
- Display keycodes back in their original format for clarity

This extends the previous UC() support to cover all QMK Unicode features
except UCIS (which requires custom keycode implementation).
- Document UC(), UM(), and UP() keycode usage in VIA
- Include firmware configuration requirements
- Add examples with emoji and Greek letters
- Note that only one Unicode mode can be enabled at a time
- Provide OS-specific setup instructions
- Include troubleshooting guide
@nkanellopoulos nkanellopoulos changed the title Add Unicode keycode support via UC() macro Add Unicode keycode support via UC() and UM() macros May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant