Beep On Idle
Play a short beep whenever an opencode agent finishes its work and waits for input.
0
66
近 7 天 9
30.1
生态多维模型
26 天前
2026-09-08
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-beep-on-idle@1.0.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-beep-on-idle@1.0.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-beep-on-idleOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
An opencode plugin that plays a short beep whenever any agent finishes its work and waits for the next input. Works for main sessions and subagents.
Requirements
- opencode with plugin support
- Linux with
canberra-gtk-play(or setBEEP_CMD, see below)
Install
From npm, in your opencode.json / opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-beep-on-idle"]
}
Or from a local path:
{
"plugin": ["/path/to/opencode-beep-on-idle/beep-on-idle.ts"]
}
Restart opencode after changing plugins — config is loaded once at startup.
Configuration
| Env var | Default | Purpose |
|---|---|---|
BEEP_CMD |
/usr/bin/canberra-gtk-play -i bell |
Shell command played on each idle event |
Example: BEEP_CMD="paplay ~/sounds/done.oga".
How it works
The plugin subscribes to opencode's event bus and fires on
session.status → idle and on session.idle. The sound is spawned
detached and fire-and-forget: awaiting audio child processes can stall the
plugin event loop (observed with proc.exited never resolving for
paplay/canberra-gtk-play/pw-play when awaited), so the child is
backgrounded (&, stdio detached) and never awaited.
Development
bun install
bun run build # bundle check
bunx tsc --noEmit # typecheck
bun run test # smoke test (uses test/fake-beep.sh, no sound played)
Note: BEEP_CMD/BEEP_MARKER must be exported before bun starts (as the
test script does) — Bun.spawn does not see process.env mutations made
at runtime.
After an opencode upgrade, re-run the checks above plus one real
listen-test (opencode run a trivial prompt), since the plugin API can shift
between versions.
Changelog
1.0.1
- Fix: add
mainentry so opencode's npm plugin loader can resolve the entrypoint (without it the plugin was silently skipped).
1.0.0
- Initial release: beep on
session.statusidle andsession.idlevia detachedcanberra-gtk-play,BEEP_CMDoverride, smoke test.
License
MIT — see LICENSE.
同类生态推荐
Simple Notify
opencode-simple-notify
Desktop notification plugin for OpenCode - works on Linux (dbus) and macOS (osascript)
Alert
@chousyn/opencode-alert
Cross-platform notification plugin for OpenCode — desktop alerts, sound alerts, and webhook notifications with project-level configuration
Notification
opencode-notification
OpenCode plugin for simple system notifications when permissions are needed, generation completes, or errors occur