Skip to content

Notification System

Dinotty has a built-in notification system supporting terminal bell detection and custom notification push, designed for AI agent and automation tool integration.

HTTP API

Send notifications via POST /api/notify:

bash
curl -s -X POST ${DINOTTY_URL}/api/notify \
  -H "Content-Type: application/json" \
  -d '{"body": "Task completed", "title": "My Agent", "notification_type": "info"}'

Request body fields:

FieldTypeRequiredDescription
bodystringNotification body
titlestringNotification title
pane_idstringAssociated pane ID (enables click-to-jump)
notification_typestringType: info (default) / success / warning / error / urgent

Click to Jump

After receiving a notification, you can jump directly to the target location:

  • Notification panel: click the notification card → auto-switch workspace → open the tab → focus the pane
  • Toast popup: click the 「Jump」 button → same full jump chain

The notification card displays a workspace › tab / pane label for easy source identification.

Environment Variables

Dinotty automatically injects the following environment variables when creating each terminal:

VariableDescription
DINOTTY_PANE_IDUnique ID of the current pane (leaf pane)
DINOTTY_TAB_IDTab ID of the current pane
DINOTTY_URLthe notify base URL of the dinotty surface that owns this pane (http://127.0.0.1:<port>) — use it instead of a hardcoded port.

Environment variables are process-level isolated — each pane is set independently and will not overwrite others.

Send notifications with these IDs for precise jump targeting:

bash
curl -X POST ${DINOTTY_URL}/api/notify \
  -H "Content-Type: application/json" \
  -d "{
    \"pane_id\": \"$DINOTTY_PANE_ID\",
    \"title\": \"Task Complete\",
    \"body\": \"Build finished\",
    \"notification_type\": \"success\"
  }"

Claude Code Integration

When running Claude Code in a dinotty terminal, you can use hooks to automatically send notifications at key moments:

jsonc
// .claude/settings.json
{
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "curl -s -X POST ${DINOTTY_URL}/api/notify -H 'Content-Type: application/json' -d '{\"body\":\"Claude needs your input\",\"title\":\"Claude Code\",\"notification_type\":\"warning\",\"pane_id\":\"'\"$DINOTTY_PANE_ID\"'\"}'"
          }
        ]
      }
    ],
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "curl -s -X POST ${DINOTTY_URL}/api/notify -H 'Content-Type: application/json' -d '{\"body\":\"Task completed\",\"title\":\"Claude Code\",\"notification_type\":\"success\",\"pane_id\":\"'\"$DINOTTY_PANE_ID\"'\"}'"
          }
        ]
      }
    ]
  }
}
HookPurpose
NotificationAlert when Claude needs user input or permission confirmation
StopAlert when a task completes

Other AI agents and automation scripts can also call the HTTP API to send notifications without additional configuration.

Tip: Use $DINOTTY_PANE_ID and $DINOTTY_TAB_ID environment variables directly in hook commands to ensure notifications can jump to the correct pane.

Notification Command Hooks

You can configure shell commands in Settings that execute automatically when notification events fire. Useful for triggering system-level alerts (e.g., macOS osascript, Linux notify-send, Windows PowerShell sounds or toasts, etc.).

Hooks run on the server platform:

PlatformExecution method
Linux / macOSsh -c <command>
Windowspwsh.exe -NoProfile -Command <command> first, then powershell.exe, then cmd.exe /C

Examples:

bash
# Linux
notify-send "Dinotty" "$DINOTTY_TITLE: $DINOTTY_BODY"

# macOS
osascript -e 'display notification "'$DINOTTY_BODY'" with title "Dinotty"'
powershell
# Windows PowerShell
[System.Media.SystemSounds]::Asterisk.Play()

Hooks receive the following environment variables:

VariableDescription
DINOTTY_NOTIFICATION_TYPENotification type
DINOTTY_PANE_IDPane ID that triggered the notification
DINOTTY_TITLENotification title
DINOTTY_BODYNotification body

Open API (External Device Control)

The POST /api/input endpoint allows external devices (Stream Deck, iOS Shortcuts, automation scripts, etc.) to send input to the terminal for remote control.

Open API must be enabled in Settings.

bash
# Send input to the active pane
curl -X POST http://127.0.0.1:8999/api/input \
  -H "Content-Type: application/json" \
  -d '{"data": "ls -la\n"}'

# Send input to a specific pane
curl -X POST http://127.0.0.1:8999/api/input \
  -H "Content-Type: application/json" \
  -d '{"data": "echo hello\n", "pane_id": "pane-1"}'

基于 MIT 许可发布