Sound Notifications in OpenCode
I've been using OpenCode for my AI development workflow over the past six months. I like the flexibility and extensibility of OpenCode. However, one feature I missed was the ability to receive sound notifications when my attention was required.
Fortunately, OpenCode has a large plugin ecosystem, which includes several notification plugins. None of these plugins I tested in the past worked fine for my specific setup (WSL2 on Windows).
Recently I discovered the @mohak34/opencode-notifier plugin and installing it, the plugin worked seamlessly.
To install the plugin, follow these simple steps:
- Modify the
~/.config/opencode/opencode.jsonfile by adding the plugin to thepluginssection:
{
"plugins": ["@mohak34/opencode-notifier@latest"]
}
- Create a new file named
~/.config/opencode/opencode-notifier.jsonwith your prefered notification settings:
{
"sound": true,
"notification": false
}
What I like about the plugin is that you can fine-tune the notifications for each event in detail by specifying custom settings in the ~/.config/opencode/opencode-notifier.json file. For instance:
{
"events": {
"permission": { "sound": true, "notification": true, "command": true, "bell": false },
"complete": { "sound": true, "notification": true, "command": true, "bell": false },
"subagent_complete": { "sound": false, "notification": false, "command": true, "bell": false },
"error": { "sound": true, "notification": true, "command": true, "bell": false },
"question": { "sound": true, "notification": true, "command": true, "bell": false },
"user_cancelled": { "sound": false, "notification": false, "command": true, "bell": false },
"plan_exit": { "sound": true, "notification": true, "command": true, "bell": false },
"session_started": { "sound": true, "notification": false, "command": true, "bell": false },
"user_message": { "sound": true, "notification": false, "command": true, "bell": false },
"client_connected": { "sound": true, "notification": false, "command": true, "bell": false }
}
}
Also, the plugin lets you specify custom sound effects for different events by adding a sounds section to the ~/.config/opencode/opencode-notifier.json file:
{
"sounds": {
"permission": "/path/to/alert.wav",
"complete": "/path/to/done.wav",
"subagent_complete": "/path/to/subagent-done.wav",
"error": "/path/to/error.wav",
"question": "/path/to/question.wav",
"user_cancelled": "/path/to/cancelled.wav",
"plan_exit": "/path/to/plan-ready.wav",
"session_started": "/path/to/session-started.wav",
"user_message": "/path/to/user-message.wav",
"client_connected": "/path/to/client-connected.wav"
}
}
If you're looking for an OpenCode notification plugin that "just works," I highly recommend trying out @mohak34/opencode-notifier.
