How it works
OpenCode uses a hook system to notify external tools when certain events occur. cmux provides anotify command that OpenCode hooks can call to create notifications.
Setup
1
Verify cmux CLI is available
The If not found, add cmux to your PATH:
cmux CLI is installed with the app. Verify it’s in your PATH:2
Configure OpenCode hooks
OpenCode supports custom hooks in its configuration. Add a notification hook that calls cmux:Create Make it executable:
~/.opencode/hooks.sh:3
Configure OpenCode to use the hook
Edit your OpenCode config (typically
~/.opencode/config.json):4
Test the integration
Run an OpenCode command and verify that notifications appear in cmux:You should see a notification in the cmux sidebar when OpenCode is waiting.
Using the notify command
Thecmux notify command sends a notification to the current workspace (or a specific workspace if targeted).
Basic usage
Options
--title: Notification title (default: “Notification”)--subtitle: Short summary text--body: Full notification message--workspace <id>: Target a specific workspace by ID or index--surface <id>: Target a specific surface/tab within the workspace
If
--workspace and --surface are omitted, cmux routes the notification to the workspace where the command was executed (via CMUX_WORKSPACE_ID and CMUX_SURFACE_ID environment variables).Examples
Environment variables
cmux automatically sets these variables in each terminal session:CMUX_WORKSPACE_ID: The current workspace IDCMUX_SURFACE_ID: The current surface (tab) IDCMUX_SOCKET_PATH: Path to the cmux control socket
Advanced integration
Progress indicators
For long-running operations, you can combine notifications with progress indicators:Status badges
Add persistent status badges to workspace tabs:Custom notification scripts
Create reusable notification scripts for common events:~/bin/notify-success
~/bin/notify-error
Viewing notifications
Use the cmux keyboard shortcuts to navigate notifications:Cmd+I: Open the notifications panelCmd+Shift+U: Jump to the latest unread notification
Troubleshooting
Notifications not appearing
Notifications not appearing
Verify the socket connection:Check the socket path:If the socket doesn’t exist, cmux may not be running.
Permission denied
Permission denied
The socket file must be owned by your user. Check:If it’s owned by another user, quit cmux and restart it.
Wrong workspace receiving notifications
Wrong workspace receiving notifications
Verify the environment variables are set:You can override them explicitly:
Related commands
cmux notify- Send notifications to workspacescmux list-notifications- View pending notifications- CLI Reference - Complete command reference including status and progress commands