Skip to content

macOS notifications show as 'Script Editor' instead of terminal app — no click-to-focus #23446

Closed as not planned

Description

@dexion

Problem

On macOS, desktop notifications from OpenCode appear to come from "Script Editor" (AppleScript) instead of the terminal emulator (iTerm2, Terminal.app, etc.). Clicking the notification opens Script Editor instead of focusing the correct terminal tab.

This happens because OpenCode uses osascript -e 'display notification...' as a fallback, and macOS attributes the notification to the osascript process (Script Editor) rather than the terminal.

Expected Behavior

  • Notifications should be attributed to the terminal emulator (iTerm2, Terminal.app, etc.)
  • Clicking a notification should focus the correct terminal tab/window
  • On iTerm2 specifically, notifications should use OSC 9 escape sequences for native integration

Current State

I found PR #23212 (feat(tui): add terminal notifications by @kitlangton) which addresses this by adding:

  • OSC 9 escape sequences (\x1b]9;message\x07) for iTerm2, Ghostty, Apple Terminal, Warp
  • OSC 777 for Kitty, WezTerm, VTE-based terminals
  • Bell (\x07) as fallback
  • Auto-detection based on TERM_PROGRAM

However, this PR is:

  • Draft status
  • Has merge conflicts
  • Open since April 18

Suggested Fix

The notification resolution logic from PR #23212 looks correct:

// For iTerm2
if (env.TERM_PROGRAM === "iTerm.app") return "osc9"  // \x1b]9;title:body\x07

// For Kitty/WezTerm
if (env.KITTY_WINDOW_ID || env.TERM === "xterm-kitty") return "osc777"  // \x1b]777;notify;title;body\x07

// Fallback
return "bell"  // \x07

Additionally, for terminals that don't support OSC sequences, consider using terminal-notifier with -activate <bundle-id>:

  • iTerm2: com.googlecode.iterm2
  • Terminal.app: com.apple.Terminal
  • Warp: dev.warp.Warp-Stable

⚠️ Do NOT use -sender flag — it conflicts with -activate on macOS Sequoia 15.x+ and breaks click-to-focus.

Environment

  • macOS (Sequoia/Tahoe)
  • iTerm2
  • OpenCode v1.14.18
  • Installed via Homebrew

Related

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Apr 19, 2026
  2. added a commit that references this issue on Apr 19, 2026
    326ba9d
  3. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  4. github-actions commented on Aug 18, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions