Skip to content

0.16.0

Latest

Choose a tag to compare

@NakaokaRei NakaokaRei released this 07 Feb 05:58
10557f4

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

  • KeyboardLayout enum.us and .jis with per-layout character-to-key mapping tables
  • Physical keyboard auto-detection — Uses KBGetLayoutType to detect hardware layout regardless of IME setting
  • CharacterKeyMapping — Pairs key and shift requirement together for accurate per-layout symbol input
  • SwiftAutoGUI.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)  // .leftBracket

Sample 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 uses currentLayout internally (@MainActor)

Full Changelog: 0.15.0...0.16.0