Skip to content

feat(notifications): add option to notify even when window is focused#18003

Open
coygeek wants to merge 1 commit intoanomalyco:devfrom
coygeek:feat/notify-when-focused
Open

feat(notifications): add option to notify even when window is focused#18003
coygeek wants to merge 1 commit intoanomalyco:devfrom
coygeek:feat/notify-when-focused

Conversation

@coygeek
Copy link
Copy Markdown

@coygeek coygeek commented Mar 17, 2026

Issue for this PR

Closes #18004

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a "Notify when focused" toggle under Settings > Notifications. When enabled, system notifications fire even when the OpenCode window has focus, instead of being suppressed.

I ran into this because I run long agent tasks while working in other sessions within the same OpenCode window. The focus-suppression meant I'd miss notifications for completed background sessions.

The implementation adds an optional { skipFocusCheck?: boolean } parameter to Platform.notify(). The notification context threads the new notifyWhenFocused setting into both notify call sites (agent idle and error). Both platform implementations (web entry.tsx and desktop index.tsx) conditionally skip the existing focus check when the flag is set.

Default is off — zero behavior change for existing users.

How did you verify your code works?

Read the source to understand the existing notification flow, traced through both web and desktop platform implementations, and verified the type changes are consistent across the Platform interface, both implementations, and the caller in notification.tsx.

Screenshots / recordings

No UI screenshot yet — the change adds one additional toggle row to the existing notification settings section, following the same SettingsRow + Switch pattern as the Agent/Permissions/Errors toggles above it.

Checklist

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

Currently, system notifications are suppressed when the OpenCode window
has focus. This is inconvenient when running long agent tasks while
working in other sessions within the same window.

Add a Notify when focused toggle under Settings > Notifications that
bypasses the focus check in both web and desktop platform notify
implementations. Default is off, preserving existing behavior.
@coygeek coygeek requested a review from adamdotdevin as a code owner March 17, 2026 22:12
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 17, 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.

[FEATURE]: Allow notifications even when OpenCode is focused

1 participant