Skip to content

XKey v1.2.5

Choose a tag to compare

@xmannv xmannv released this 20 Dec 16:28
· 239 commits to main since this release

What's New

fix: Support non-QWERTY keyboard layouts (Swiss French, AZERTY, etc.)

Previously, XKey only worked correctly with QWERTY keyboard layouts.
When users had Input Sources like Swiss French (QWERTZ) or French (AZERTY),
Vietnamese typing didn't work because the app was using physical keyCodes
instead of the actual characters from the Input Source.

Root cause:

  • KeyboardEventHandler was converting keyCode → character using QWERTY mapping
  • This ignored the user's actual Input Source settings
  • Example: Swiss French 'z' key (physical Y position) was treated as 'y'

Solution:

  1. Get character directly from event.characters (respects Input Source)
  2. Convert character → QWERTY keyCode for engine processing
  3. Added KeyCodeToCharacter.keyCode(forCharacter:) helper function

Changes:

  • XKey/EventHandling/KeyboardEventHandler.swift:

    • Use event.characters instead of KeyCodeToCharacter.qwertyCharacter()
    • Convert character → engineKeyCode before passing to VNEngine
    • Special keys (arrows, tab, esc, etc.) still use physical keyCode
  • XKey/EventHandling/KeyCodeToCharacter.swift:

    • Added keyCode(forCharacter:) function for reverse mapping
    • Supports letters, numbers, and special characters

Testing:

  • Swiss French (QWERTZ): typing 'thuzj' → 'thụy' ✅
  • French (AZERTY): typing works correctly ✅
  • US (QWERTY): no change in behavior ✅
  • Special keys: arrows, tab, backspace all work ✅