A blazing faster IME switching tool for macOS. (Swift / launchd service)
I've used macism and im-select before.
But on my older Macs, these tools always required a short wait to switch IME modes. It was an unacceptable delay for daily use.
macime significantly reduces this delay by 30% to 70%. (Depends on usage.)
Though it still has a slight delay, but I’m very satisfied with the switching speed since v3.x.
If you’re a Mac user frustrated by slow IME switching, give it a try.
- Sets and gets the IME in a single operation
- Uses a launchd service
- Written in native Swift
- Optimized code
- Get current IME
- Set a specified IME
- Save current IME
- Load(Restore) the previous IME
- Switch IME while saving the previous one (in single step)
- List all IMEs
- Output results in plain text or JSON string
- Faster switching by
macimedlaunchd service
- macOS
brew tap riodelphino/tap
brew install macimebrew uninstall macimebrew update
brew upgrade macimeIf launchd service is enabled, ensure to restart it:
brew services restart macimeOptional, but STRONGLY RECOMMENDED !!.
30% faster than running macimed directly. (e.g. 128ms -> 89ms)
# Start macimed service
brew services start macime
# Stop macimed service
brew services stop macime
# Manually start (for test, can see the log)
macimedShow macime version:
macime --versionShow macime help:
macime --helpSub commands:
macime get [options]
macime set <IME_ID> [options]
macime list [options]
macime save [options]
macime load [options]get
Show the current IME.
set
Switch to the specified IME.
Optionally saves the previous IME.
list
List available IMEs.
save
Save current IME.
load
Restore the previous IME.
macime get
# com.apple.keylayout.ABC
macime get --detail
# id: com.apple.keylayout.ABC
# localizedName: ABC
# isSelectCapable: true
# isSelected: true
# sourceLanguages: ["en", "af", ... "zu"]
macime get --detail --json
# {"isSelectCapable":true,"isSelected":true,"sourceLanguages":["en","af", ... ,"zu"],"localizedName":"ABC","id":"com.apple.keylayout.ABC"}# Set IME
macime set com.apple.keylayout.ABC
# Set IME while saving current IME as `DEFAULT`
macime set com.apple.keylayout.ABC --save
# The IME ID is saved at `/tmp/riodelphino.macime/prev/DEFAULT`
# Set IME while saving current IME as <session_id>
macime set com.apple.keylayout.ABC --save --session-id nvim-1001
# The IME ID is saved at `/tmp/riodelphino.macime/prev/nvim-1001`Note
Using set and --save together reduces elapsed time 50%.
While other tools need two excution like <command_name> -> <command_name> set com.apple.keylayout.ABC
# Save current IME to `DEFAULT`
macime save
# Current IME ID is set to `/tmp/riodelphino.macime/prev/DEFAULT`
# Save current IME to `<session_id>`
macime save --session-id nvim-1001
# Current IME ID is set to `/tmp/riodelphino.macime/prev/nvim-1001`# Load IME from `DEFAULT`
macime load
# Reads previous IME ID from `/tmp/riodelphino.macime/prev/DEFAULT`, then set it.
# Load IME from `<session_id>`
macime load --session-id nvim-1001
# Reads previous IME ID from `/tmp/riodelphino.macime/prev/nvim-1001`, then set it.macime list # id list
macime list --detail # detailed list
macime list --json # json list
macime list --select-capable # show only selectable IME methods
# --detail, --json and --select-capable can be mixturedmacimed is bundled with macime and can be managed by launchd via:
brew services start macime
# Although the service name is `macime`, `macimed` is executed internally.When run as a launchd service, execution time is reduced by about 30% compared to running macimed directly.
You can also start macimed manually to monitor logs and observe its behavior, though this is slower.
macimed leaves log.
The log location depends on whether it is run directly or via launchd, and on the environment.
Log:
- /tmp/riodelphino.macimed.log
- /usr/local/var/log/riodelphino.macimed.log
- /opt/homebrew/var/log/riodelphino.macimed.log (Apple Silicon)
Error:
- /tmp/riodelphino.macimed.err
- /usr/local/var/log/riodelphino.macimed.err
- /opt/homebrew/var/log/riodelphino.macimed.err (Apple Silicon)
(Recommended) Install wrapper plugin: riodelphino/macime.nvim
For more details, see doc/integration.md.
The previous IME ID is stored in:
When directly executing macimed:
/tmp/riodelphino.macime/<session_id>
With brew services start:
/private/tmp/riodelphino.macime/<session_id>
These files are deleted when you shutdown macOS.
For faster switching with low latency, set this config in init.lua:
vim.o.timeoutlen = 0 -- 0 ~ 50Warning
This config affects other keybinds in nvim.
azookey | azookey-Desktop prevents macime set command to work.
I guess it's because they are still alpha version.
Solutions for now:
- Uninstal
azookey
Contributions are welcome:
# Clone
git clone https://github.com/riodelphino/macime
cd macime
# Build for debug
swift build
# Build for release
swift build -c releaseDeprecated: $MACIME_TEMP_DIR environmental value
See CHANGELOG
MIT License. See LICENSE
- Neovim IMEの状態をカーソルの色に反映させる (Japanese)