opencode-terminal-bell-notifierZero-dependency OpenCode plugin that sends desktop notifications via OSC 9 terminal escape sequences
5
1,741
近 7 天 344
38.3
生态多维模型
4 个月前
2026-03-24
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-terminal-bell-notifier@0.2.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-terminal-bell-notifier@0.2.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-terminal-bell-notifieropencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Zero-dependency OpenCode plugin that sends desktop notifications using OSC 9 terminal escape sequences.
No osascript, no notify-send, no external binaries, no npm dependencies. Just a single escape sequence written to stdout that your terminal emulator interprets as a notification.
Install
Add to your opencode.json:
{
"plugin": ["opencode-terminal-bell-notifier@latest"]
}
Restart OpenCode.
What it does
Sends a terminal notification when:
- The agent finishes a task
- The agent asks a question
- Permission is requested
- An error occurs
How it works
The plugin writes an OSC 9 escape sequence directly to stdout:
\x1b]9;<message>\x07
Terminal emulators that support OSC 9 (Ghostty, iTerm2, kitty, foot, Windows Terminal, Warp) display this as a native desktop notification. Terminals without OSC 9 support still fire the trailing BEL byte (\x07) as an audible or visual bell.
How it differs from other notification plugins
Most notification plugins shell out to platform-specific tools (osascript on macOS, notify-send on Linux) or pull in npm packages like node-notifier. This plugin does none of that:
- No runtime dependencies
- No child processes
- No platform detection
- No permission prompts except native OS notifications permission
- Works on any OS as long as the terminal supports OSC 9 or BEL
The tradeoff is that notifications are handled entirely by the terminal emulator, so behavior (sound, badge, banner) depends on your terminal's settings.
If your terminal is in the foreground, it may or may not suppress the notification. Check your terminal's documentation for notification configuration options.
Terminal support
| Terminal | OSC 9 notifications | BEL fallback |
|---|---|---|
| Ghostty | ✅ | ✅ |
| iTerm2 | ✅ | ✅ |
| kitty | ✅ | ✅ |
| foot | ✅ | ✅ |
| Windows Terminal | ✅ | ✅ |
| WezTerm | ✅ | ✅ |
| Warp | ✅ | ✅ |
| Terminal.app | ❌ | ✅ |
| Alacritty | ❌ | ⚠️ visual only |
| GNOME Terminal / VTE | ❌ | ⚠️ audio only |
| Konsole | ❌ | ✅ |
| xfce4-terminal | ❌ | ✅ |
| urxvt | ❌ | ✅ |
| ConEmu | ❌ | ✅ |
| mintty | ❌ | ✅ |
| Tabby | ❌ | ⚠️ buggy |
License
MIT