A blazing faster IME switching tool for macOS. (Swift via 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
- List all IMEs
- Switch IME while saving the previous one (in single step)
- Output results in plain text or JSON string
- Faster switching by
macimedlaunchd service - Fallback to
im-selectstyle command usage
- macOS (>=10.13)
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 (Faster)
brew services start macime
# Stop `macimed` service
brew services stop macime
# Manually start `macimed` for debugging to see the log (Slower)
macimedShow macime version:
macime --version
macime -vShow macime help:
macime --help
macime -hSub 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 supports im-select–style shortcuts.
# Falls back to `macime get`
macime
# Falls back to `macime set`
macime com.apple.keylayout.ABCmacime 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 mixtured| Option | Available for | Description |
|---|---|---|
| --detail | get, list | Show detailed IME info |
| --select-capable | get, list | Show only selectable IME |
| --json | get, list | Output as json text |
| --save | set | Save current IME (with macime set only) |
| --session-id <session_id> | save, load | Specify the save / load session id (= filename in temp dir) |
| --launchd | (any) | Indicate called via launchd (Ommit [ERROR] prefix from stderr) |
Some unavailable options for each sub command will be simply ignored.
macimed is bundled with macime.
Show macimed version:
macimed --version
macimed -vShow macimed help:
macimed --help
macimed -hRecommended (Faster)
macimed can be managed by launchd via Homebrew:
brew services start macime
# Although the service name is `macime`, it runs `macimed` internally.When launched this way, execution is typically about 30% faster than running it manually.
For Debugging (Slower)
You can also start macimed manually to monitor logs and observe its behavior:
macimedUseful for debuging, but performance will be slower.
macimed listens to:
- /tmp/riodelphino.macime.sock
macimed leaves log and err.
Directly running macimed:
- /tmp/riodelphino.macimed.log
- /tmp/riodelphino.macimed.err
Via brew services (Apple Intel):
- /usr/local/var/log/riodelphino.macimed.log
- /usr/local/var/log/riodelphino.macimed.err
Via brew services (Apple Silicon):
- /opt/homebrew/var/log/riodelphino.macimed.log
- /opt/homebrew/var/log/riodelphino.macimed.err
(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.
When using --detail together with --json, macime outputs array values as malformed JSON strings.
- Subcommands:
get,list - Options:
--detail --json
azookey | azookey-Desktop prevents macime set command to work.
I guess it's because they are still alpha version.
Solutions for now:
- Uninstal
azookey
Note
This error was caused by a merge conflict in the tap repository. Sorry for my git mistake.
If you encounter a syntax error during install/reinstall/upgrade macime:
Error: riodelphino/tap/macime: /usr/local/Homebrew/Library/Taps/riodelphino/homebrew-tap/Formula/macime.rb:2: syntax errors found
...
<<<<<<< HEAD
...
~~~~~~
...
=======Resolve it with the follwing steps:
# Remove macime and the tap
brew uninstall macime
brew untap riodelphino/tap
# Reinstall the tap and macime
brew tap riodelphino/tap
brew install macimeThis cleans up the corrupted tap cache and performs a fresh installation.
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 in v3.0.0
See CHANGELOG
MIT License. See LICENSE
- Neovim IMEの状態をカーソルの色に反映させる (Japanese)