ToolingProjects

Thai Typo Fixer — forgot to switch layouts? One key fixes it

This project came from a small frustration I hit every day: forgetting to switch layouts and having to delete everything. If one key press can convert it back, life gets a lot easier.

6 min read

A fix for something Thai users run into every day: forgetting to switch the input language and typing a whole sentence in the wrong layout. One shortcut converts it back to Thai.

PythonSwiftmacOS Accessibility APIpynputKedmanee LayoutSelf-Learning

First — see what happens

Everyone has done this...

A chat window with the text l;ylfu8iy[ selected in the input box, and a hint to press Control Shift TAfter conversion the input box reads สวัสดีครับ ("hello"), with a note that the pair was remembered, 1 of 3 times
Concept images — left: forgot to switch layouts, select the text and press the shortcut · right: Thai text right away (converted with the real Kedmanee mapping)
Meant to type "สวัสดีครับ" ("hello") but forgot to switch the layout
l;ylfu8iy[
⬇
สวัสดีครับ
Press Ctrl + Shift + T to convert instantly
Or "ทดสอบ" ("test")
mflv[
⬇
ทดสอบ
Works in any app — Browser Slack LINE VS Code

Design Thinking Process

From a small daily annoyance to a tool idea for every Thai user

Hands typing on a keyboard in front of a computer screen
The mistake happens in the fingers, not the head — the fingers hit the right keys, just in the wrong language · Photo: Ilya Pavlov / Unsplash

Empathize · Everyone has been there — half a sentence in before realizing the layout is wrong

Thai users type two languages on the same keyboard and switch dozens of times a day. Sometimes 10-20 characters go by before you notice you're still in English mode, and then you have to delete everything and retype it. It wastes time and it's very frustrating.

Pain point: every time you forget to switch, it's delete → switch layout → retype everything = lost time + lost patience

Define · "Why delete and retype when my fingers already hit the right keys?"

The characters that come out match the Kedmanee keyboard positions one for one. For example, the l key sits in the same spot as ส. So just "converting" the text back gives the intended Thai, with no retyping.

HMW: How might we convert text typed in the wrong layout back to what the user meant to type, with a single key press?

Ideate · Mapping Table + Self-Learning Dictionary

The core idea has two parts:

• Keyboard Mapping — a 1:1 lookup table from EN key → TH character (Kedmanee layout)
• Learning Engine — remembers pairs it has converted and gets better with use. Once a pair has been converted ≥3 times, it auto-replaces without the shortcut

Key idea: a system that "gets smarter the more you use it" — it learns from real behavior, with nothing to configure

Prototype · Lean prototype — Python first, Swift later

I started with a Python prototype because it's fast to build:

• pynput — catches the hotkey (Ctrl+Shift+T) system-wide
• pyperclip — captures text through the clipboard (select → copy → convert → paste)
• JSON file — a simple dictionary stored in ~/Library/Application Support/ThaiTypoFix/

Strategy: get the Python prototype working for real first, then port it to a Swift menu bar app for production

Test · Using it myself every day — the best dogfooding

Tested by using it in real work — chat, writing code, answering email — to check whether it captures text correctly in every app, whether the dictionary learns fast enough, and whether the shortcut clashes with other apps

Validation: if I use it every day and feel I "can't do without it" = pass

Keyboard mapping — the heart of the system

EN key → TH character on the Kedmanee layout (1:1 mapping)

A keyboard diagram where each key shows its English and Kedmanee Thai character, highlighting the keys used to type สวัสดีครับ with the press order
The 1:1 Kedmanee layout — purple keys are the ones pressed to type "สวัสดีครับ"; the numbers are the press order

Example: l;ylfu8iy[ → สวัสดีครับ

l
↓
ส
;
↓
ว
y
↓
ั
l
↓
ส
f
↓
ด
u
↓
ี
8
↓
ค
i
↓
ร
y
↓
ั
[
↓
บ

System Architecture

Data flow from the shortcut press to the Thai text

The macOS menu bar with the Thai Typo Fixer menu open: convert selected text, 24 remembered words, and Auto-replace
Concept image of the Swift menu bar app — every step in the diagram below runs behind this small icon
01

Shortcut Listener

Catch Ctrl+Shift+T system-wide

02

Text Capture

Copy the selected text through the clipboard

03

Mapping Engine

Check the dictionary first → if not found, use the Kedmanee mapping

04

Text Replace

Paste the Thai text in its place

05

Learning Engine

Save the EN→TH pair to dictionary.json


Self-Learning Dictionary

A system that improves with use — learning from real user behavior

A table of remembered words showing English and Thai pairs, a count bar, and auto or manual status
Concept image — words converted 3 times switch to auto-replace (pairs converted with the real mapping)

How it learns

01

The user types mflv[ and presses the convert shortcut

02

The system converts it to ทดสอบ ("test") → saves the pair to the dictionary (count = 1)

03

Used again → count += 1, more confidence

04

Once count ≥ 3 → auto-replace, no shortcut needed

Times usedConfidenceMode
count = 11/3Manual
count = 22/3Manual
count = 33/3 ✓Auto!
dictionary.json
{ "mflv[": { "value": "ทดสอบ", "count": 5 }, "l;ylfu8iy[": { "value": "สวัสดีครับ", "count": 12 } }

Works anywhere on macOS

Runs system-wide — press the shortcut in any app to convert

A person working on a MacBook at a desk
Works at the system level, not tied to any app · Photo: Glenn Carstens-Peters / Unsplash
Safari / Chrome Slack LINE Notion VS Code Terminal Word / Pages

Roadmap

A 3-phase roadmap — from simple conversion to context-aware AI

A suggestion box above the text mflv[ saying it looks like the wrong layout, convert to ทดสอบ, with a convert button
Phase 2 concept — the system guesses the layout is wrong and offers a conversion you accept with Tab

Phase 1 — Core

Keyboard mapping + Shortcut trigger + Dictionary learning

Phase 2 — Smart

Auto-detection + Pattern learning + Thai spell check

Phase 3 — AI

AI typo prediction + Context-aware correction

01

Phase 1 — MVP: Keyboard Layout Conversion

Kedmanee mapping table + hotkey trigger + clipboard-based text capture + a JSON dictionary that learns from use

02

Phase 2 — Smart Detection: knows on its own when the layout is wrong

Analyzes the pattern of typed text — if it finds EN characters that aren't English words, it suggests converting automatically + Thai spell checking

03

Phase 3 — AI-powered: understands context, predicts ahead

Uses AI to predict that the user is typing in the wrong layout before they finish, and corrects based on sentence context


Target Metrics

Performance targets

Close-up of backlit keyboard keys in the dark
The goal is to be fast enough that you don't feel a tool in between · Photo: Sam Albury / Unsplash
<50ms
Conversion Latency
<50MB
Memory Usage
≥3
Auto-replace Threshold
100%
Kedmanee Coverage

Key Takeaways

What I learned from thinking this project through

Hands typing on a silver laptop
A small problem you hit every day is the most worthwhile brief · Photo: Mimi Thian / Unsplash

Small problems everyone has gotten used to = good opportunities. Forgetting to switch layouts happens to Thai users every day, but nobody thinks it "can be fixed" because deleting and retyping feels normal. Looking at small problems people accept as normal is where valuable tools come from.

A 1:1 mapping made a hard-looking problem easy. At first I thought it would need complex NLP or ML, but on closer analysis the Kedmanee layout is a straight 1:1 mapping, so a lookup table converts 100% of it. The lesson: understand the problem deeply before thinking about the solution.

Self-learning doesn't have to be complicated. The learning algorithm is just "count the times". Very simple, but effective, because people's repeated typing patterns are a clear signal. No neural network needed to build something that gets better with use.

Always prototype before production. The Python prototype let me validate the idea quickly without first learning Swift and the whole Accessibility API. If the prototype works well, then it's worth investing time in a native app.

Tan · Natpakan Sirirat

Product Designer & AI Builder — designing user experiences and building AI tools that actually work.

0%