Mac切换到指定输入法
系统默认的输入法切换方式,本质是“切换到下一个输入法”或“切换到上一个输入法”,常常是输错了字符才发现选错了输入法,误选输入法的几率很大,容易干扰工作节奏。
尤其在开发工作中,窗口之多,中、英文切换之频繁,能直接指定输入法是很有必要的。
实现方法,使用 Keyboard Maestro 绑定快捷键,执行切换输入法的脚本。
脚本安装(InputSourceSelector)
仓库地址: Github
下载后,进入脚本根目录,执行
make
生成可执行文件 InputSourceSelector,将其放到 用户目录 ~/
Keyboard Maestro 设置快捷键
可能会用到命令(更多命令在文末):
// 切换到ABC输入法
~/InputSourceSelector select com.apple.keylayout.ABC
//切换到双拼输入法
~/InputSourceSelector select com.apple.inputmethod.SCIM.Shuangpin
//切换到拼音输入法
~/InputSourceSelector select com.apple.inputmethod.TCIM.Pinyin
//所有可见的输入法名称,可以通过该命令查看
~/InputSourceSelector list-enabled
Keyboard Maestro的设置很简单,就是触发快捷键,执行shell动作。
建议选用的快捷键不要有手指大幅度的移动,不然很影响效率。
配置参考如下,
InputSourceSelector的相关命令
Usage
$ InputSourceSelector [command]
[command] is described below.
Commands
- list Lists currently installed input sources.
- list-enabled Lists currently enabled input sources.
- current Prints currently selected input source.
- current-layout Prints currently used keyboard layout.
- enable [input source ID] Enables specified input source.
- **disable [input source ID] **Disables specified input source.
- select [input source ID] Selects specified input source.
- deselect [input source ID] Deselects specified input source.
[input source ID] is one of the input source IDs printed by list,list-enabled,current,current-layout commands, such as com.apple.keylayout.US or com.apple.inputmethod.Kotoeri.Japanese.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!