Skip to content

Fix missed hotkey releases while OpenWispr is active#85

Open
Chipagosfinest wants to merge 1 commit into
human37:mainfrom
Chipagosfinest:agent/fix-active-app-hotkey-release
Open

Fix missed hotkey releases while OpenWispr is active#85
Chipagosfinest wants to merge 1 commit into
human37:mainfrom
Chipagosfinest:agent/fix-active-app-hotkey-release

Conversation

@Chipagosfinest

@Chipagosfinest Chipagosfinest commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Fixes #86.

  • Monitor hotkey events delivered to OpenWispr itself in addition to events delivered to other apps.
  • Route both event scopes through the existing hotkey state machine without consuming local AppKit events.
  • Add a regression test that exercises both monitor paths and verifies both monitor tokens are removed.

Why

OpenWispr currently installs only NSEvent.addGlobalMonitorForEvents. Per Apple's event-monitor contract, a global monitor observes events dispatched to other applications, not the application that installed it. If OpenWispr is active—for example while its menu is open—a hold-to-talk key-down may be observed globally, while the matching release is delivered locally and missed. The recorder lifecycle then remains in its recording state after the user releases the key.

Installing the complementary local monitor closes that event-scope gap. Local events are returned unchanged so normal AppKit handling continues.

This is separate from #83, which recovers recorder state across macOS sleep/wake.

Apple reference: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/MonitoringEvents/MonitoringEvents.html

User impact

Hold-to-talk recording now stops when the hotkey is released even if OpenWispr becomes the active application during the gesture.

Validation

  • git diff --check
  • swift test --filter HotkeyManagerTests — 1 test, 0 failures
  • swift test — 125 tests, 0 failures
  • swift build -c release

Scope

Only hotkey event monitoring and its focused regression test changed. Recording, transcription, clipboard insertion, configuration, and menu behavior are otherwise unchanged.

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.

Hold-to-talk can miss hotkey release while OpenWispr is active

1 participant