[[OpenCode]] supports desktop notifications and sound alerts through the `@mohak34/opencode-notifier` plugin. This is how to set it up on [[macOS]] with [[Ghostty]].
## Plugin installation
Add the plugin to the global [[OpenCode]] config at `~/.config/opencode/opencode.jsonc`:
```jsonc
{
"plugin": ["@mohak34/opencode-notifier@latest"]
}
```
After adding it, kill all OpenCode processes and restart. The plugin is installed automatically via Bun at startup.
## Notification system
The plugin supports three notification backends on macOS: `osascript` (default, shows Script Editor icon), `node-notifier` (custom icon but unreliable), and `ghostty` (native terminal notifications via OSC 777).
## Configuration
Create `~/.config/opencode/opencode-notifier.json` to customize behavior. The current configuration uses Ghostty notifications with macOS system sounds:
```json
{
"notificationSystem": "ghostty",
"sounds": {
"complete": "/System/Library/Sounds/Tink.aiff",
"error": "/System/Library/Sounds/Sosumi.aiff",
"permission": "/System/Library/Sounds/Basso.aiff",
"question": "/System/Library/Sounds/Pop.aiff"
}
}
```
## Events
| Event | When it fires | Sound |
|---|---|---|
| `complete` | Session finished | Tink |
| `error` | Session error | Sosumi |
| `permission` | Agent needs approval | Basso |
| `question` | Agent asks a question | Pop |
| `subagent_complete` | Subagent finished | Silent by default |
| `user_cancelled` | ESC pressed | Silent by default |
## Other options
The plugin also supports per-event volume control (`volumes`), custom notification messages with placeholders like `{sessionTitle}` and `{projectName}`, focus suppression (`suppressWhenFocused`), and a custom command hook to run arbitrary scripts on events.