### Install macism via Homebrew Source: https://github.com/laishulu/macism/blob/master/README.md Tap the custom Homebrew repository and install the macism package. ```shell brew tap laishulu/homebrew brew install macism ``` -------------------------------- ### Show macism version Source: https://github.com/laishulu/macism/blob/master/README.md Display the installed version of the macism tool. ```shell macism --version ``` -------------------------------- ### Get Current Input Source Source: https://context7.com/laishulu/macism/llms.txt When called without arguments, this command prints the identifier of the currently active keyboard input source. Example output includes 'com.apple.keylayout.ABC' for US English. ```shell macism # Example output: # com.apple.keylayout.ABC # Other common output values: # com.apple.inputmethod.SCIM.ITABC (Simplified Chinese) # com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese (Japanese) # com.apple.keylayout.Korean (Korean) ``` -------------------------------- ### Build macism from Source Source: https://context7.com/laishulu/macism/llms.txt Clone the repository and use make commands to build the CLI and helper app. Use 'make clean' to remove artifacts and 'make rebuild' for a clean build. ```shell git clone https://github.com/laishulu/macism cd macism make # builds both macism CLI and TemporaryWindow.app make clean # remove build artifacts make rebuild # clean + build ``` -------------------------------- ### Compile macism from source Source: https://github.com/laishulu/macism/blob/master/README.md Clone the repository, navigate to the directory, and run make to compile. ```shell git clone https://github.com/laishulu/macism cd macism make ``` -------------------------------- ### Invoke TemporaryWindow.app for CJKV Focus Workaround Source: https://context7.com/laishulu/macism/llms.txt Use these commands to run the TemporaryWindow.app helper, which applies the CJKV focus-workaround. You can set a custom wait time using the MACISM_WAIT_TIME_MS environment variable. ```sh # Run the temporary window workaround with default timing open -a /path/to/TemporaryWindow.app ``` ```sh # Run with a custom 80 ms wait time MACISM_WAIT_TIME_MS=80 open -a /path/to/TemporaryWindow.app ``` ```sh # Or invoke the binary directly MACISM_WAIT_TIME_MS=80 /path/to/TemporaryWindow.app/Contents/MacOS/TemporaryWindow ``` -------------------------------- ### Switch Input Source without CJKV Workaround Source: https://context7.com/laishulu/macism/llms.txt Pass '0' as the second argument to skip the temporary-window workaround. Use this when the CJKV bug does not affect your system or is not desired. ```shell # Switch to Japanese without the workaround macism com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese 0 ``` -------------------------------- ### Configure Emacs smart-input-source with macism Source: https://context7.com/laishulu/macism/llms.txt Use this configuration in your Emacs init file to set macism as the backend for smart-input-source. It enables automatic context detection and input source restoration. ```elisp ;; ~/.emacs or ~/.emacs.d/init.el (use-package smart-input-source :config (setq sis-external-ism "macism") ; use macism as the backend (sis-global-respect-mode t) ; switch to English on Normal/motion state (sis-global-context-mode t) ; auto-detect context and switch (sis-global-inline-mode t)) ; restore CJK inside inline regions ``` -------------------------------- ### Switch Input Source with CJKV Workaround Source: https://context7.com/laishulu/macism/llms.txt Switches to the specified input source by its full identifier. For CJKV sources, macism applies a temporary-window focus trick to ensure the switch fully takes effect. The default wait time for the workaround is 1 ms. ```shell # Switch to Simplified Chinese macism com.apple.inputmethod.SCIM.ITABC # Switch to Japanese (Romaji) macism com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese # Switch back to US English macism com.apple.keylayout.ABC # Verify the switch succeeded macism # Output: com.apple.keylayout.ABC ``` -------------------------------- ### Switch input source with workaround Source: https://github.com/laishulu/macism/blob/master/README.md Switch to a specified input source ID, utilizing a workaround for a known macOS bug. ```shell macism SOME_INPUT_SOURCE_ID ``` -------------------------------- ### Show current input source Source: https://github.com/laishulu/macism/blob/master/README.md Display the currently active input source on macOS. ```shell macism ``` -------------------------------- ### Show macism Version Source: https://context7.com/laishulu/macism/llms.txt Prints the current version string of the macism CLI. This command exits immediately after displaying the version. ```shell macism --version # Output: # v3.0.10 ``` -------------------------------- ### Switch input source without workaround Source: https://github.com/laishulu/macism/blob/master/README.md Switch to a specified input source ID without applying the macOS bug workaround. ```shell macism SOME_INPUT_SOURCE_ID 0 ``` -------------------------------- ### Set Custom Wait Time for CJKV Workaround Source: https://context7.com/laishulu/macism/llms.txt Controls the duration (in milliseconds) that the temporary window holds focus during the CJKV workaround. This can be set via the MACISM_WAIT_TIME_MS environment variable or by passing '0' as the second argument to disable the workaround. ```shell # Use a custom 100 ms wait time when switching to Chinese MACISM_WAIT_TIME_MS=100 macism com.apple.inputmethod.SCIM.ITABC # Disable the workaround entirely via the CLI second argument macism com.apple.inputmethod.SCIM.ITABC 0 ``` -------------------------------- ### Toggle Between English and Chinese Input Sources via Shell Source: https://context7.com/laishulu/macism/llms.txt This shell script checks the current input source and toggles it between English (com.apple.keylayout.ABC) and Chinese (com.apple.inputmethod.SCIM.ITABC) using the macism command. ```sh #!/bin/bash ENGLISH="com.apple.keylayout.ABC" CHINESE="com.apple.inputmethod.SCIM.ITABC" current=$(macism) if [ "$current" = "$ENGLISH" ]; then macism "$CHINESE" else macism "$ENGLISH" fi ``` -------------------------------- ### Vim/Neovim: Restore English on Normal Mode Source: https://context7.com/laishulu/macism/llms.txt Automatically switches back to the ABC layout when entering Normal mode and restores the previous input source in Insert mode. Requires setting the 'g:input_source_english' variable. ```vim " ~/.vimrc or ~/.config/nvim/init.vim let g:input_source_english = 'com.apple.keylayout.ABC' function! RestoreEnglish() let l:current = system('macism') let l:current = substitute(l:current, '\n', '', 'g') if l:current != g:input_source_english let b:saved_input_source = l:current call system('macism ' . g:input_source_english) endif endfunction function! RestorePrevious() if exists('b:saved_input_source') call system('macism ' . b:saved_input_source) endif endfunction autocmd InsertLeave * call RestoreEnglish() autocmd InsertEnter * call RestorePrevious() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.