ภาษาไทย: คู่มือภาษาไทยอยู่ด้านล่าง ⬇ · ฉบับ PDF สำหรับพิมพ์/ส่งต่อ: คู่มือ-thaikeyfix.pdf
A tiny background Windows program that fixes text typed with the wrong keyboard layout. Highlight the mistyped text in any application, press Ctrl+` (the key just above Tab), and it swaps the characters between the Thai (Kedmanee) and US English layouts in place.
It does not translate meaning. It remaps each character by its physical key
position — the same trick as classic layout-fixer tools. Example: trying to type
สวัสดี with the US layout still active gives l;ylfu; select it, press Ctrl+, and you get สวัสดี` back. It works both directions and auto-detects which.
Why not Alt+Q? Alt+Q is a built-in Microsoft Word shortcut (it opens the "Tell Me / Search" box), and Alt drives the Word ribbon, so it stole the keystroke and pasting misbehaved. Ctrl+` avoids all of that and is unused in Word.
- Ctrl+` — convert the text you have highlighted yourself.
- Ctrl+1 — no highlighting needed. Put the cursor at the end of the mistyped word and press it; the tool selects the last run of same-language characters automatically and converts just that.
Both auto-detect direction (Thai↔English) and can be used in any app that supports normal keyboard selection and copy/paste.
Whenever you switch the keyboard language — with the ` (grave) key, Alt+Shift or Win+Space — the tool plays a short beep pitched by the language you just switched to:
- English → high beep (1400 Hz)
- Thai → low beep (550 Hz)
The tray icon doubles as a big language indicator: it shows a blue ท while the window you're in uses the Thai layout and a green E while it uses English — updating as you switch languages or move between windows, so a glance at the tray always tells you what you're about to type.
The beep is stricter than the icon. A beep requires both: a switch key was pressed (, Alt+Shift, Ctrl+Shift or Win+Space) within the last second, **and** the language of the window you're in really changed. That means clicking between windows or taskbar icons never beeps (no key was pressed — Windows' focus-time language sync can't trigger it), and typing a literal `` `` character or using
Ctrl+Shift app shortcuts stays silent too (no language change follows).
Switching via the taskbar language menu with the mouse alone is the one path
that stays silent by design. Toggle the feature via
Language sound: On/Off in the tray menu; Pause also silences it. To
change the pitch or length, edit BEEP_EN_HZ / `BEEP_TH_HZ` / `BEEP_MS` in
`src/main.rs`.
Right-click the empty background of any folder in Explorer and pick
Save clipboard image to PNG: whatever image is on the clipboard (a PrtScn
screenshot, a picture copied from a browser or document) is saved into that
folder as clip_YYYYMMDD_HHMMSS.png (with _2, _3, ... if you save twice
in the same second). A soft chirp confirms the save; if the clipboard has no
image you get a small explanatory popup instead. Note that copying an image
file in Explorer copies the file, not the image — open the image and copy it
for this to work.
The menu registers itself automatically every time thaikeyfix starts, under
HKCU\Software\Classes\Directory\Background\shell (per-user; no admin
prompt), pointing at the running exe — so if you move the exe, the menu
follows on the next start. Turn it off (and remove the registry entry) via
Folder menu (save clipboard PNG): On/Off in the tray menu; the choice is
remembered across restarts.
- The two hotkeys are registered globally (
RegisterHotKey), so they fire no matter which app is focused. - Ctrl+` waits for the held keys to lift, then simulates Ctrl+C to copy your selection. Ctrl+1 instead grows a selection leftward one character at a time (Shift+Left), checking after each step whether the character is Thai or Latin, and stops when the run changes script — so it grabs exactly the last mistyped word/run.
- The text is run through the Kedmanee↔QWERTY position table. If it contains any Thai characters it is converted Thai→English, otherwise English→Thai.
- The result is placed on the clipboard and pasted back with Ctrl+V, replacing the selection. Your previous clipboard contents are then restored.
There is no universal Windows API to read text around the cursor from an arbitrary app, so the copy-convert-paste (and simulated-selection) approach is how every tool of this kind works.
No installation needed — it's a single portable exe.
-
winget (recommended — no SmartScreen prompts):
winget install "nitichote@dev.thaikeyfix"If it says No package found, run
winget source updateonce and retry. -
Download: grab
thaikeyfix-vX.Y.Z-x64.exefrom the Releases page, put it anywhere, and run it.
Updating: new versions don't auto-install. Run winget upgrade --all
now and then to pick them up (works for every winget app at once). To get
notified when a new version is released, click Watch → Custom → Releases
at the top of this repo — GitHub will email you on each release.
Or build it yourself:
You need the Rust toolchain (https://rustup.rs) on Windows.
cargo build --releaseThe binary lands at target\release\thaikeyfix.exe. Release builds use
windows_subsystem = "windows", so there is no console window — it runs in
the background and shows only a system-tray icon (a small blue/green square
next to the clock).
Double-click thaikeyfix.exe (or run it from a terminal). Then in any program:
either select mistyped text → Ctrl+`, or just leave the cursor after the
mistyped word → Ctrl+1.
You'll see the language icon appear in the system tray (bottom-right, near the
clock — you may need to click the ^ to expand hidden icons): blue ท =
Thai layout active, green E = English. Right-click it for:
- Pause / Resume — temporarily turn the hotkeys (and the sound) off without quitting.
- Language sound: On/Off — toggle the language-switch beep.
- Folder menu (save clipboard PNG): On/Off — add/remove the Explorer right-click menu entry.
- Start with Windows: Off / On / On (Administrator) — click to cycle.
On launches thaikeyfix at sign-in with normal rights (a per-user
Runregistry entry). On (Administrator) registers a Task Scheduler task that starts it elevated at sign-in with no UAC prompts — needed for the hotkeys to work inside apps that themselves run as administrator (hospital software like HOSxP, etc.). Switching to/from Administrator asks for UAC once, at toggle time only. - About... — shows the version and author.
- Quit thaikeyfix — stop the program.
Opening the exe while thaikeyfix is already running simply does nothing — the running instance keeps working, so you never get a confusing "hotkey already in use" popup from double-launching it.
The compiled .exe also carries the author and description under right-click →
Properties → Details (embedded via build.rs).
Run a debug build (cargo run) if you want a console with log messages while
testing.
Right-click the tray icon and turn on Start with Windows — that's it.
(The old manual way still works too: put a shortcut to the exe in the Startup
folder via Win+R → shell:startup.)
The layout table has unit tests (no Windows APIs needed for these):
cargo test- Change the hotkey: edit
MOD_CONTROL/VK_OEM_3insrc/main.rs. The modifier flags areMOD_CONTROL = 0x0002,MOD_ALT = 0x0001,MOD_SHIFT = 0x0004; OR them together. The second value is the virtual-key code (e.g.0x51=Q,0xC0=`). For example Ctrl+Shift+Q isMOD_CONTROL | MOD_SHIFTwith0x51. - Change the mapping: edit the
PAIRStable insrc/layout.rs. Each entry is(english_char, thai_char)for one key. The table is verified against Microsoft's official KBDTH0 layout and is a clean bijection.
- Apps running as Administrator (common for hospital/enterprise software like HOSxP) won't receive the simulated keystrokes when thaikeyfix runs with normal rights — Windows blocks input from lower- to higher-privilege processes (UIPI). Fix: set the tray menu's Start with Windows to On (Administrator) — one UAC prompt, then thaikeyfix starts elevated at every sign-in and works inside those apps too.
- It overwrites the selection via paste, so it only works where you can paste (most text fields; not, say, read-only views).
- The tool waits ~150 ms after Ctrl+C and ~400 ms after Ctrl+V (so apps like
Word finish pasting before the old clipboard is restored). If conversion still
occasionally misses or pastes the old text on a slow machine, increase those
Duration::from_millis(...)values insrc/main.rs. - 11 punctuation keys (e.g.
_ / - % + " , . ( ) ?) produce ASCII on the Thai side. In an all-ASCII selection the direction detector can't tell those apart from English, so isolated punctuation may convert unexpectedly. Real mistyped words (which contain Thai letters) are unaffected. - Only the standard Kedmanee layout is included. Pattachote or other layouts
would need a different
PAIRStable.
Cargo.toml dependencies (arboard, enigo, winapi, png, winreg)
src/main.rs hotkey registration, message loop, copy/convert/paste,
language-switch sound + tray language icon, CLI mode
src/layout.rs the Kedmanee<->QWERTY table + convert() + tests
src/clipsave.rs clipboard-image -> PNG + Explorer context-menu registry
assets/ embedded tray icons (ท = Thai, E = English)
โปรแกรมเล็ก ๆ ทำงานเบื้องหลังบน Windows มีความสามารถ 3 อย่าง: แก้ข้อความที่พิมพ์ผิดภาษา (ลืมสลับแป้น), มีเสียงและไอคอนบอกภาษาที่กำลังใช้, และเซฟรูปจากคลิปบอร์ดเป็นไฟล์ PNG ด้วยเมนูคลิกขวา — ฉบับเต็มพร้อมภาพขั้นตอนอยู่ที่ คู่มือ-thaikeyfix.pdf
วิธีที่ง่ายที่สุด — เปิด PowerShell แล้ววางบรรทัดเดียว (ไม่เจอหน้าเตือน SmartScreen):
winget install "nitichote@dev.thaikeyfix"(ถ้าขึ้น No package found ให้รัน winget source update หนึ่งครั้งแล้วลองใหม่
เสร็จแล้วปิด-เปิด PowerShell ใหม่ พิมพ์ thaikeyfix เพื่อเปิดโปรแกรม)
หรือดาวน์โหลด thaikeyfix-vX.Y.Z-x64.exe จากหน้า
Releases
วางไว้ในโฟลเดอร์ถาวร (เช่น C:\Tools\thaikeyfix) แล้วดับเบิลคลิก —
ครั้งแรกถ้า Windows ขึ้นจอฟ้า SmartScreen ให้กด More info → Run anyway
เปิดแล้วจะเห็นไอคอนภาษาที่ tray มุมขวาล่าง แนะนำคลิกขวาไอคอน → เปิด Start with Windows ให้โปรแกรมมาเองทุกครั้งที่เปิดเครื่อง
อัปเดตเวอร์ชันใหม่: โปรแกรมไม่อัปเดตตัวเอง — รัน winget upgrade --all
เป็นครั้งคราวเพื่อรับเวอร์ชันล่าสุด และถ้าอยากได้อีเมลแจ้งทุกครั้งที่ออกเวอร์ชันใหม่
กดปุ่ม Watch → Custom → Releases ที่หัว repo นี้ได้เลย
ใช้กับโปรแกรมที่รันแบบ Administrator (เช่น HOSxP): ถ้ากดปุ่มลัดใน โปรแกรมพวกนี้แล้วไม่มีอะไรเกิดขึ้น เป็นเพราะ Windows ห้ามโปรแกรมสิทธิ์ธรรมดา ส่งปุ่มเข้าโปรแกรมสิทธิ์ admin — แก้ง่าย ๆ: คลิกขวาไอคอน tray แล้วกด Start with Windows ให้เป็น On (Administrator) (กดวนได้: Off → On → On (Administrator)) ยืนยัน UAC หนึ่งครั้ง จากนั้นทุกครั้งที่เข้า Windows โปรแกรมจะเปิดด้วยสิทธิ์ admin เองเงียบ ๆ และใช้ในโปรแกรมเหล่านั้นได้ทันที
| ปุ่มลัด | การใช้ |
|---|---|
Ctrl + ` |
ไฮไลต์ข้อความที่พิมพ์ผิดก่อน แล้วกด — สลับไทย⇄อังกฤษให้ทันที |
Ctrl + 1 |
ไม่ต้องไฮไลต์ วางเคอร์เซอร์ท้ายคำที่ผิดแล้วกด แปลงคำล่าสุดให้เอง |
เช่น l;ylfu → สวัสดี, mflv[ → ทดสอบ — โปรแกรมเลือกทิศทางเองอัตโนมัติ
กดปุ่มสลับภาษา (`, Alt+Shift, Ctrl+Shift, Win+Space) แล้วจะมีเสียงสั้น ๆ
บอกภาษาใหม่ทันที: อังกฤษ = เสียงสูง, ไทย = เสียงต่ำ และไอคอน tray
เปลี่ยนตามภาษาปัจจุบันตลอดเวลา: ท พื้นน้ำเงิน = ไทย / E พื้นเขียว = อังกฤษ
คลิกสลับหน้าต่างเฉย ๆ จะไม่มีเสียงรบกวน ปิด/เปิดเสียงได้ที่เมนู tray
จับหน้าจอ (PrtScn หรือ Win+Shift+S) หรือ copy รูปจากที่ไหนก็ได้
แล้วคลิกขวาบนพื้นที่ว่างในโฟลเดอร์ → Save clipboard image to PNG
ได้ไฟล์ clip_วันที่_เวลา.png ทันที (Windows 11 อาจต้องกด "Show more options"
ก่อน) เมนูนี้ลงทะเบียนให้เองตอนเปิดโปรแกรม ถอนออกได้จากเมนู tray
Pause/Resume พักการทำงานชั่วคราว · Language sound: On/Off เปิด/ปิดเสียง · Folder menu: On/Off เพิ่ม/ถอนเมนูคลิกขวาในโฟลเดอร์ · Start with Windows: On/Off เปิดเองทุกครั้งที่เข้า Windows (แนะนำให้เปิด) · About... ข้อมูลโปรแกรม · Quit ปิดโปรแกรม
เผลอเปิดโปรแกรมซ้ำก็ไม่เป็นไร — ตัวใหม่จะปิดตัวเองเงียบ ๆ ตัวเดิมทำงานต่อตามปกติ
ตั้ง Folder menu เป็น Off และ Start with Windows เป็น Off ก่อน (ถอนรายการที่ลงทะเบียนไว้ออกจาก Windows) → Quit → ลบไฟล์ exe — ไม่มีไฟล์ตกค้าง โปรแกรมทำงานในเครื่องทั้งหมด ไม่ส่งข้อมูลออกอินเทอร์เน็ต