Skip to content

An input method selection tool for macOS based on im-select, but with more stable performance. 「一个mac平台下基于 im-select 的输入法选择工具, 但效果更稳定。」

License

Notifications You must be signed in to change notification settings

LuSrackhall/ims-mac

Repository files navigation

ims-mac

A macOS input method selection tool based on im-select, but with more stable performance and seamless replacement capability.

Working Principle

Quickly refreshes input focus by generating a temporary window to actively activate the input method.

This high-performance, painless approach perfectly solves the current macOS platform bug where input methods with candidate boxes (such as all Chinese input methods) may occasionally fail to activate properly when only using system API calls to switch input methods.

Advantages Over Other Solutions

This solution is non-intrusive and nearly identical to native API switching. See this analysis for detailed information.

Unless Apple fixes the input method switching API bug in the future, this is currently the most perfect solution. We also welcome more clever mechanism solutions for comparison.

Due to the significant advantages of this solution:

  • The macism project, which has been dedicated to solving this problem in the community, also switched from simulating keyboard input to using this mechanism in v2 to improve performance and switching reliability.
  • I also shared insights about potentially incorporating this solution with the im-select project community -> see this link.

Installation

Using Homebrew (Recommended)

brew install lusrackhall/tap/ims-mac

The final installation path through brew is typically: /opt/homebrew/bin/

To uninstall, use the following command:

brew uninstall lusrackhall/tap/ims-mac

Only applicable if installed via brew. If you installed manually, please refer to the installation and uninstallation instructions on the release page.

Manual Installation

Please visit the release page for installation.

Thanks

im-select project

Before using macOS, I had been using the im-select project on Windows for many years. This project was initially based on im-select for further implementation.

macism project author

The temporary window method was initially just a solution I conceived but hadn't implemented for my personal project switch-input-method to address related issues

Since the original solution was sufficient for personal use, I hadn't proceeded with implementation.

However, simple communication with laishulu accelerated my implementation of this approach, and prompted me immediately after successful verification to:

  • Share insights about the temporary window method with everyone.
  • Separate the complete solution from my personal project (giving birth to the current ims-mac project) to share and help more people.

Influenced by this insight, the macism project completely removed its original core keyboard input simulation mechanism in v2 and switched to the same temporary window mechanism as this project. This upgrade greatly improved macism's performance and switching reliability.

About

An input method selection tool for macOS based on im-select, but with more stable performance. 「一个mac平台下基于 im-select 的输入法选择工具, 但效果更稳定。」

Resources

License

Stars

Watchers

Forks

Packages

No packages published