|
1 | 1 | # opencode-notification |
| 2 | + |
| 3 | +OpenCode plugin for desktop notifications in TUI workflows. |
| 4 | + |
| 5 | +You get notifications when: |
| 6 | + |
| 7 | +- A response is ready |
| 8 | +- A permission is requested |
| 9 | +- A question is asked |
| 10 | +- A session hits an error |
| 11 | + |
| 12 | +Designed for low-noise defaults, Claude Code inspired behavior, and OpenCode Desktop parity where possible. |
| 13 | + |
| 14 | +## Install |
| 15 | + |
| 16 | +Add the plugin to your OpenCode config: |
| 17 | + |
| 18 | +```json |
| 19 | +{ |
| 20 | + "$schema": "https://opencode.ai/config.json", |
| 21 | + "plugin": ["opencode-notification@latest"] |
| 22 | +} |
| 23 | +``` |
| 24 | + |
| 25 | +Then restart OpenCode. |
| 26 | + |
| 27 | +## Configure |
| 28 | + |
| 29 | +The plugin reads `oc-notification.json` from these locations (lowest to highest precedence): |
| 30 | + |
| 31 | +1. Global: `~/.config/oc-notification.json` (or `%APPDATA%\\oc-notification.json` on Windows) |
| 32 | +2. Project root: `<project>/oc-notification.json` |
| 33 | +3. Project OpenCode folder: `<project>/.opencode/oc-notification.json` |
| 34 | + |
| 35 | +Configs are merged in this order, so later files override earlier ones. |
| 36 | + |
| 37 | +Default config: |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "$schema": "https://unpkg.com/opencode-notification@latest/schema/oc-notification.json", |
| 42 | + "delay": 15, |
| 43 | + "enabled": true, |
| 44 | + "response_ready": { "enabled": true }, |
| 45 | + "error": { "enabled": true }, |
| 46 | + "permission_asked": { "enabled": true }, |
| 47 | + "question_asked": { "enabled": true } |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +Minimal low-noise example: |
| 52 | + |
| 53 | +```json |
| 54 | +{ |
| 55 | + "$schema": "https://unpkg.com/opencode-notification@latest/schema/oc-notification.json", |
| 56 | + "delay": 15, |
| 57 | + "enabled": false, |
| 58 | + "permission_asked": { "enabled": true }, |
| 59 | + "question_asked": { "enabled": true } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +### Options |
| 64 | + |
| 65 | +- `delay` (number): Default delay before showing notifications (seconds). |
| 66 | +- `enabled` (boolean): Master on/off switch for all notifications. |
| 67 | +- `response_ready`, `error`, `permission_asked`, `question_asked`: Per-event settings. |
| 68 | +- `response_ready.enabled`, `error.enabled`, `permission_asked.enabled`, `question_asked.enabled` (boolean): Enable or disable each event. |
| 69 | +- `response_ready.delay`, `error.delay`, `permission_asked.delay`, `question_asked.delay` (number, optional): Per-event delay override in seconds. |
| 70 | + |
| 71 | +## Events |
| 72 | + |
| 73 | +- `response_ready`: Sent when OpenCode becomes idle after an assistant response. |
| 74 | +- `error`: Sent when a session errors. |
| 75 | +- `permission_asked`: Sent when OpenCode requests permission. |
| 76 | +- `question_asked`: Sent when OpenCode asks a question. |
| 77 | + |
| 78 | +## Project Direction |
| 79 | + |
| 80 | +- Mimic Claude Code style notification behavior as closely as possible. |
| 81 | +- Reach feature parity with OpenCode Desktop notifications where possible within TUI limits. |
| 82 | +- Keep behavior configurable and low-noise by default. |
| 83 | +- Contribute improvements upstream to OpenCode once behavior is stable. |
| 84 | + |
| 85 | +## Platform Notes |
| 86 | + |
| 87 | +- Linux: Uses `notify-send` when available, otherwise terminal bell. |
| 88 | +- macOS: Uses `osascript` notifications. |
| 89 | +- Windows: Uses PowerShell toast notifications, then `msg`, then bell fallback. |
| 90 | + |
| 91 | +If notifications do not appear on Linux, install a notification daemon and ensure `notify-send` is available. |
| 92 | + |
| 93 | +## License |
| 94 | + |
| 95 | +Apache-2.0. See `LICENSE`. |
0 commit comments