What's New
JIS Keyboard Layout Support
SwiftAutoGUI now supports JIS (Japanese Industrial Standard) keyboard layout in addition to US. The physical keyboard type is auto-detected, so symbols like @, [, :, _ are mapped to the correct keys automatically.
New Features
KeyboardLayoutenum —.usand.jiswith per-layout character-to-key mapping tables- Physical keyboard auto-detection — Uses
KBGetLayoutTypeto detect hardware layout regardless of IME setting CharacterKeyMapping— Pairs key and shift requirement together for accurate per-layout symbol inputSwiftAutoGUI.currentLayout— Read the detected layout or manually override it- JIS-specific keys —
.jisYen(¥),.jisUnderscore(ろ),.jisEisu(英数),.jisKana(かな) Key.from(character:layout:)— Layout-explicit key lookup usable from any concurrency context
Usage
// Auto-detected — just works on both US and JIS keyboards
await SwiftAutoGUI.write("Hello @world [test]")
// Manually override
SwiftAutoGUI.currentLayout = .jis
// Reset to auto-detection
SwiftAutoGUI.resetLayoutToAutoDetect()
// Explicit layout lookup
let key = Key.from(character: "@", layout: .jis) // .leftBracketSample App
- Added KB Layout demo tab with layout switching, US/JIS mapping comparison table, and symbol typing test
Backward Compatibility
- Existing code continues to work without changes
- US layout environments behave identically to before via auto-detection
Key.from(character:)now usescurrentLayoutinternally (@MainActor)
Full Changelog: 0.15.0...0.16.0