macism

repository·master·Indexed 18 days ago

https://github.com/laishulu/macism

A command-line tool for managing macOS input sources, specifically designed to reliably handle CJKV (Chinese, Japanese, Korean, Vietnamese) input source switching. It includes a workaround for a macOS bug where the input source icon changes but the IME does not activate, offering both a Stable Mode with a configurable wait time and a Fast Mode for lower latency.

Tokens
762
Snippets
7
Records
7
Agent score
13%

What's inside macism

  1. Install macism via Homebrew or Source

    master

    You can install macism using Homebrew or by compiling it from the source code.

    Using Homebrew

    brew tap laishulu/homebrew
    brew install macism

    Compiling from Source

    git clone https://github.com/laishulu/macism
    cd macism
    make
    brew tap laishulu/homebrew
    brew install macism
  2. Configure switch wait time for macOS stability

    master

    The third argument to the macism command allows you to specify a custom wait time in milliseconds for the stability workaround.

    On macOS 26 (Tahoe), the default is 150ms. Using a value too low may cause CJK IMEs (like Squirrel) to fail to take over before typing begins, causing characters to leak in the previous IME.

    • macOS 26 (Tahoe): 150ms is recommended for full stability.
    • Older macOS versions: You can use much smaller values (e.g., 50ms) for snappier switching.

    Total latency is approximately cold-start + wait.

    # Example: Switch with a 50ms wait time
    macism SOME_INPUT_SOURCE_ID 50 50
  3. Switch macOS input source

    master

    Use macism to switch to a specific input source ID. The tool provides two modes to handle a specific macOS bug where CJKV (Chinese, Japanese, Korean, Vietnamese) input sources fail to activate correctly unless a workaround is applied.

    Stable Mode (Workaround enabled)

    Use this if your input source triggers the macOS bug (where the menu bar icon changes but the actual input method does not). This mode uses a TemporaryWindow to ensure the switch is reliable.

    macism SOME_INPUT_SOURCE_ID

    Fast Mode (Workaround disabled)

    Use this if your input source does not trigger the bug for a better user experience (lower latency).

    macism SOME_INPUT_SOURCE_ID 0

    Customizing the Wait Time

    The third parameter allows you to specify the wait time (in milliseconds) for the workaround. The default is 150ms, which is tested to be stable on macOS 26 (Tahoe). If the wait time is too short, the first 1–2 characters might be typed using the previous input method before the new one takes control.

    • Default: 150ms (Highly stable)
    • Optimized for older macOS: You can provide a smaller value (e.g., 50ms) if you are on an older OS version to reduce latency.

    Example with custom wait time:

    macism SOME_INPUT_SOURCE_ID 50
    macism SOME_INPUT_SOURCE_ID