Skip to content

docs: cross-platform focus-aware notification example (WSL + macOS + Linux) - #45326

Open
davissekai wants to merge 2 commits into
anomalyco:devfrom
davissekai:docs-crossx-notify
Open

docs: cross-platform focus-aware notification example (WSL + macOS + Linux)#45326
davissekai wants to merge 2 commits into
anomalyco:devfrom
davissekai:docs-crossx-notify

Conversation

@davissekai

@davissekai davissekai commented Aug 26, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #4846
Related #213

Type of change

  • Documentation

What does this PR do?

The plugins docs showed a macOS-only osascript example for notifications. It fails on WSL/Linux and most community plugins are also macOS-only.

This updates packages/web/src/content/docs/plugins.mdx to a cross-platform, focus-aware example:

  • WSL via PowerShell Windows.UI.Notifications toast
  • macOS via osascript
  • Linux via notify-send
  • Only pings when the terminal is not frontmost (checks GetForegroundWindow on WSL, osascript frontmost on macOS, xdotool on Linux)
  • Handles session.idle, session.error, and permission.updated / permission.ask with debounce, visual only by default

It also points to the community plugin opencode-notify-crossx (https://github.com/davissekai/opencode-notify-crossx) for the full source, and shows a single-file local alternative that works without npm.

How did you verify your code works?

  • Restarted opencode on WSL Ubuntu 22.04, log shows notify plugin loaded (focus-aware)
  • While opencode was focused, permission ask was suppressed: suppressed (focused) at 16:04:50
  • Switched to Chrome, same permission triggered toast: opencode — input needed at 16:05:52
  • Also verified session.idle suppress/notify in the same way

Screenshots / recordings

Tested via Windows toast — no screenshot needed for docs-only change. Log lines above show both paths.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 26, 2026
@davissekai

Copy link
Copy Markdown
Author

Fixed PR description to follow template — added Issue, Type of change, What does this PR do, How verified, Screenshots, Checklist sections. Ready for review.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notification plugin from docs doesn't work

1 participant