Skip to content

feat: support multiple keyboard layouts per language (Dvorak, Colemak) #38

@chernistry

Description

@chernistry

Summary

RightLayout currently assumes QWERTY as the base layout for Latin scripts. Users who use alternative layouts like Dvorak or Colemak cannot use RightLayout effectively because the key-to-character mapping is completely different. Supporting alternative layouts would unlock a passionate and vocal user community.

Why This Matters

  • Dvorak and Colemak users are a small but highly engaged community
  • These users are often power users and early adopters — exactly the audience that spreads word of mouth
  • Alternative layout users already deal with software compatibility issues daily — a tool that supports them earns loyalty
  • Proves the layout engine is truly layout-agnostic, not QWERTY-hardcoded

Layouts to Support

Dvorak

' , . p y f g c r l / =
a o e u i d h t n s -
; q j k x b m w v z

Colemak

q w f p g j l u y ; [ ]
a r s t d h n e i o '
z x c v b k m , . /

Colemak-DH (popular variant)

q w f p b j l u y ; [ ]
a r s t g m n e i o '
z x c d v k h , . /

Implementation Plan

1. Extend layouts.json structure

File: RightLayout/Sources/Resources/layouts.json

Current structure (assumed):

{
  "english": { "a": "a", "b": "b", ... },
  "russian": { "a": "ф", "b": "и", ... }
}

New structure:

{
  "english": {
    "qwerty": { "a": "a", "b": "b", ... },
    "dvorak": { "a": "a", "b": "x", ... },
    "colemak": { "a": "a", "b": "b", ... }
  },
  "russian": {
    "qwerty": { "a": "ф", "b": "и", ... }
  }
}

2. Auto-detect active keyboard layout

  • macOS provides the current input source via TISCopyCurrentKeyboardInputSource()
  • Map input source IDs to layout types:
    • com.apple.keylayout.Dvorak → Dvorak
    • com.apple.keylayout.Colemak → Colemak
    • com.apple.keylayout.US → QWERTY

3. Update detection engine

  • When detecting wrong layout, use the ACTIVE layout's mapping, not hardcoded QWERTY
  • Character-to-key mapping must be reversible for any supported layout

4. Settings UI

Allow manual override in case auto-detection fails:

Keyboard Layout: [Auto-detect ▼]
  - Auto-detect
  - QWERTY
  - Dvorak
  - Colemak
  - Colemak-DH

Test Cases

  • Dvorak user types Russian text on Dvorak → correct detection and correction
  • Colemak user types English text on Russian layout → correct detection and correction
  • Auto-detection identifies Dvorak layout correctly
  • Auto-detection identifies Colemak layout correctly
  • Layout switch mid-session is handled (user switches from QWERTY to Dvorak)
  • Unknown layout falls back to QWERTY gracefully

Edge Cases

  • Users with custom layouts (Karabiner-Elements remapping) — may not match any known layout
  • Workman, Norman, and other niche layouts — out of scope initially but architecture should support adding them
  • Layout detection should refresh when input source changes (subscribe to kTISNotifySelectedKeyboardInputSourceChanged)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions