Many voice input tools (e.g. Whisper-based apps, dictation software) work by writing recognized text to the clipboard and simulating Cmd+V. In terminal apps like Claude Code, multi-line pastes trigger Bracket Paste Mode, which wraps content in \e[200~...\e[201~ escape sequences. This causes pasted text to be collapsed, garbled, or even freezes the terminal entirely.
A macOS menu bar app that intercepts Cmd+V in specified terminals via CGEvent Tap, swallows the paste event, reads the clipboard, and re-types the content character-by-character using CGEvent Unicode key events — completely bypassing paste detection.
Voice Input Tool -> Clipboard + Cmd+V
|
InterceptService -> CGEvent Tap intercepts Cmd+V -> swallow -> read clipboard
|
TypeService -> CGEvent keyboardSetUnicodeString (chunked typing, up to 20 UTF-16 units per event)
-> post to .cgAnnotatedSessionEventTap (bypass tap interference)
|
Terminal / Claude Code -> Receives keyboard input (not paste) -> no bracket paste mode
Ghostty, Terminal.app, iTerm2, Alacritty, WezTerm, kitty, Warp — configurable via the menu bar UI.
Download the latest VoiceInput.app.zip from Releases, unzip, and drag VoiceInput.app to your Applications folder.
# Requires Xcode Command Line Tools
# If not installed: xcode-select --install
git clone https://github.com/BigKunLun/VoiceInput-Patch.git
cd VoiceInput-Patch
./build.sh
open VoiceInput.appSince the app is not notarized by Apple, macOS may block it. Use any of these methods:
Method A: Remove quarantine via terminal (recommended)
xattr -cr VoiceInput.appMethod B: Right-click open
Right-click VoiceInput.app → Select "Open" → Click "Open" in the dialog
Method C: System Settings
After the app is blocked, go to System Settings → Privacy & Security → scroll down to find "VoiceInput was blocked" → click "Open Anyway"
System Settings → Privacy & Security → Accessibility → Add and enable VoiceInput
- After launch, the app appears in the menu bar (waveform icon)
- Click the icon to open the menu, check the terminals you want to monitor
- Click the start button to begin interception
- Use voice input normally in the specified terminals — paste in non-whitelisted apps is unaffected
- Newlines in clipboard content are replaced with spaces to prevent premature command submission in terminal apps like Claude Code.
- Text longer than 10,000 characters is truncated for safety.
- macOS 13.0+ (Apple Silicon / Intel)
- Xcode Command Line Tools
- Accessibility permission
许多语音输入法(闪电说、讯飞语音等)通过「剪贴板 + Cmd+V」粘贴识别结果。在 Claude Code 等终端应用中,多行粘贴会触发 Bracket Paste Mode,导致语音输入内容被折叠、乱码,甚至终端完全冻结。
macOS 菜单栏应用,通过 CGEvent Tap 拦截指定终端中的 Cmd+V,吞掉粘贴事件,改用 CGEvent Unicode 逐字键入,绕过粘贴检测。
语音输入法 -> 写入剪贴板 + Cmd+V
|
InterceptService -> CGEvent Tap 拦截 Cmd+V -> 吞掉 -> 读取剪贴板
|
TypeService -> CGEvent keyboardSetUnicodeString 分块键入(每事件最多 20 UTF-16 码元)
-> post 到 .cgAnnotatedSessionEventTap(绕过 tap 干扰)
|
终端 / Claude Code -> 收到逐字键盘输入(非粘贴)-> 不触发折叠
兼容所有通过「写入剪贴板 + 模拟 Cmd+V」工作的语音输入法(闪电说、讯飞语音等)。
通过输入法框架直接输入的方式(如 macOS 系统听写)本身就是逐字输入,不会触发折叠,无需本工具。
预设支持 Ghostty、Terminal、iTerm2、Alacritty、WezTerm、kitty、Warp,可通过菜单栏界面勾选。
从 Releases 下载最新的 VoiceInput.app.zip,解压后将 VoiceInput.app 拖入应用程序文件夹。
# 需要 Xcode Command Line Tools
# 如未安装: xcode-select --install
git clone https://github.com/BigKunLun/VoiceInput-Patch.git
cd VoiceInput-Patch
./build.sh
open VoiceInput.app由于应用未经 Apple 公证,macOS 可能阻止打开。任选一种方式解决:
方式 A:命令行解除隔离(推荐)
xattr -cr VoiceInput.app方式 B:右键打开
右键点击 VoiceInput.app → 选择「打开」→ 在弹窗中点击「打开」
方式 C:系统设置放行
打开应用被阻止后,前往 系统设置 → 隐私与安全性 → 下方会显示「已阻止 VoiceInput」→ 点击「仍要打开」
系统设置 → 隐私与安全性 → 辅助功能 → 添加并勾选 VoiceInput
- 启动后应用显示在菜单栏(波形图标)
- 点击图标打开菜单,勾选需要监听的终端
- 点击启动按钮开始拦截
- 在指定终端中正常使用语音输入即可,非白名单应用中的粘贴不受影响
- 剪贴板中的换行符会被替换为空格,以避免在 Claude Code 等终端中触发提前提交。
- 超过 10,000 字符的文本会被截断保护。
- macOS 13.0+(Apple Silicon / Intel 均可)
- Xcode Command Line Tools
- 辅助功能权限
VoiceInput-Patch/
├── Package.swift # SPM 配置
├── Sources/
│ ├── VoiceInputApp.swift # SwiftUI 应用入口(MenuBarExtra)
│ ├── Models/
│ │ ├── AppState.swift # 运行状态、统计数据
│ │ └── Settings.swift # 终端白名单、UserDefaults 持久化
│ ├── Services/
│ │ ├── InterceptService.swift # CGEvent Tap 拦截 Cmd+V
│ │ └── TypeService.swift # CGEvent Unicode 分块键入
│ └── Views/
│ └── MenuBarView.swift # 菜单栏下拉菜单
├── build.sh # 构建脚本(swift build + 打包 .app)
└── docs/
└── technical-notes.md # 技术要点与决策记录