Notify Crossx
Cross-platform desktop notifications for opencode — pings when run finishes or input is needed. Focus-aware, WSL + macOS + Linux. No sound by default, visual toast only.
0
53
近 7 天 6
28.8
生态多维模型
1 个月前
2026-08-26
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-notify-crossx@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-notify-crossx@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-notify-crossxOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Cross-platform desktop notifications for opencode — get pinged when your run finishes or when input is needed.
Focus-aware: only pings when opencode is not the frontmost window, so you are not spammed while watching.
| Platform | Visual | Sound (off by default) | Focus check |
|---|---|---|---|
| WSL (Windows) | PowerShell Windows.UI.Notifications toast |
SystemSounds |
GetForegroundWindow |
| macOS | osascript display notification |
afplay |
System Events frontmost |
| Linux | notify-send via libnotify |
paplay |
xdotool |
No sound by default — visual toast only. Set sound: true in code to re-enable.
Install
npm i -g opencode-notify-crossx
# or for local install
npm i opencode-notify-crossx
Add to your opencode config:
~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-notify-crossx"]
}
Or project-level .opencode/opencode.json:
{
"plugin": ["opencode-notify-crossx"]
}
Restart opencode.
What triggers a ping
session.idle→ Run finishedsession.error→ Run failedpermission.updated/permission.ask→ Input needed
Debounced per session/permission to avoid spam.
Focus-aware
Only notifies when the terminal is not focused. If opencode is the frontmost window (Windows Terminal, VS Code, etc.), the ping is suppressed and logged as suppressed (focused).
To notify even when focused, edit index.js:
const CONFIG = {
onlyWhenUnfocused: false, // always ping
sound: false,
}
Sound
Off by default per user request. To enable:
const CONFIG = {
sound: true,
}
Local development (single-file plugin)
The same code also works as a single-file local plugin at ~/.config/opencode/plugins/notify.js — no npm needed. See index.js source.
How it works
isWsl()checks/proc/versionformicrosoft/wslisTerminalFocused()checks foreground window title via PowerShell on WSL/Windows, AppleScript on macOS,xdotoolon LinuxsendDesktop()triesosascript→ PowerShell toast →notify-sendin ordernotify()respectsCONFIG.onlyWhenUnfocusedandCONFIG.sound
License
MIT
Author
Davis Dey — first open source contribution, built live with opencode
同类生态推荐
Simple Notify
opencode-simple-notify
Desktop notification plugin for OpenCode - works on Linux (dbus) and macOS (osascript)
Smart Notify
opencode-smart-notify
Desktop notifications for OpenCode that stay quiet when auto-approve handles the request
Alert
@chousyn/opencode-alert
Cross-platform notification plugin for OpenCode — desktop alerts, sound alerts, and webhook notifications with project-level configuration