Completion notification (popup + sound) when the window is unfocused#212
Open
leonidasbarkas98-cpu wants to merge 1 commit into
Open
Conversation
…cused Adds an opt-out sticky toast and an opt-in completion sound that fire when a Claude turn finishes while the VS Code window is not focused (andrepimenta#92, andrepimenta#51). Nothing fires while the window is focused — no point interrupting someone who is already watching the chat. - New settings claudeCodeChat.notifications.completionPopup (default true) and claudeCodeChat.notifications.completionSound (default false). - The toast carries an 'Open Chat' action button: an action makes it sticky (VS Code auto-hides plain toasts after a few seconds, so a notification fired while unfocused would be gone by the time the user switches back). The action reveals the chat panel. - The sound is two short sine tones scheduled via the Web Audio API against the context's *current* time, only once the context is guaranteed running — tones scheduled against a suspended context's frozen currentTime never audibly play. - Browsers only allow AudioContext.resume() to settle after a user gesture: a one-time warm-up listener (first pointerdown/keydown in the webview) resumes the context early so it is already running by the time a sound needs to play from an unfocused window; a 2s timeout guards the resume() promise so a never-settling resume can't leak state. - Audio failures never break the webview message handler. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a completion notification for turns that finish while the VS Code window is not focused: a sticky toast (opt-out) and a short completion sound (opt-in). Nothing fires while the window is focused.
Details:
claudeCodeChat.notifications.completionPopup(default true) andclaudeCodeChat.notifications.completionSound(default false).AudioContext.resume()settle after a user gesture: a one-time warm-up listener (first pointerdown/keydown in the webview) resumes the context early so it is already running when a sound needs to play from an unfocused window; a 2s timeout guards the resume promise.Addresses #92 and #51. Based on current main (ab6e307),
tsc --noEmitclean, no new dependencies.