Repository navigation
fix: stop Escape from playing the error sound when closing capture - #393
Merged
Merged
Conversation
The capture overlay's local key monitor returned
`self?.handleLocalKeyEvent(event) ?? event`, which turns a nil result
("consumed") back into the event. After Escape closed the overlay, the
event kept going through AppKit with no key window left, which played
the system alert sound. Holding Escape beeped again for every
autorepeat, since those still go to Capso after the overlay is gone.
- Return the monitor's result as is, so handled keys are consumed.
- Swallow the autorepeats and keyUp of the Escape press that closed an
overlay or the Quick Access card.
- Fix the same `?? event` pattern in the annotation tool shortcut
monitor.
Fixes #356
Co-Authored-By: Claude Opus 5.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.
Fixes #356
Summary
self?.handleLocalKeyEvent(event) ?? event. Anilresult means "consumed", but?? eventturned it back into the event, so nothing the overlay handled was consumed. After Escape closed the overlay, the event kept going through AppKit with no key window left, and-[NSApplication sendEvent:]played the alert sound.EscapeKeyPressSwallowerdrops the autorepeats and keyUp of the press that closed an overlay. The next press is let through as usual. The Quick Access card's Escape button uses it too.?? eventpattern and is fixed too.Validation
NSBeep. Before the fix: one beep per tap, plus one per autorepeat while holding Escape, matching the report.EscapeKeyPressFilterTests,EscapeKeyPressSwallowerTests, and twoCaptureOverlayInteractionTeststhat call the installed monitor handler. Both overlay tests fail with the old?? eventcode.CapsoTestssuite passes locally (244 tests).🤖 Generated with Claude Code